Solved

input random elements to an array

Posted on 1998-08-06
3
236 Views
Last Modified: 2010-04-16
If I have an array or an type of all "char" ,  how can I  input a random result from that array into a smallar array, f.x.  array [1..5] of Char;
, or better, a few arrays of that same type.
0
Comment
Question by:gudbgud
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:gudbgud
ID: 1217273
Edited text of question
0
 

Author Comment

by:gudbgud
ID: 1217274
Edited text of question
0
 
LVL 2

Accepted Solution

by:
vx earned 50 total points
ID: 1217275
I coded a little program for you; I think it does what you mean:

Var FirstArray: Array[1..100] of Char;          { The whole array }
    SecArray:   Array[1..5] of Char;            { The new array }
    Counter:    Integer;                        { A random number }

Begin
  Repeat
    Randomize;                                  { Initialize random sequence }
    Counter := Random(100)+1;                   { Create a random number and add one to that }
                                                { Random generates a number from 0<=x<100 }
                                                { The array shouldn't be addresses with 0, so add one }
    SecArray := FirstArray[Counter];            { Copy a number from the first array to the second }
  Until KeyPressed;
End.
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains the fundamentals of industrial networking which ultimately is the backbone network which is providing communications for process devices like robots and other not so interesting stuff.
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question