Need help with RANDOMIZE/RND 
Author Message
 Need help with RANDOMIZE/RND

Quote:

>..I want to use the command RANDOM or RND command to ..
>but I can't find out how to do it..

Use 'RANDOMIZE once to start a series of (pseudo) random numbers.
Subsequent calls to RND gives (pseuso)random numbers 0 - 1.
You can convert this range to an integer range:

RANDOMIZE
for i = 1 to 100
  print INT(RND * 1000); ' will give numbers 0 - 999
  next i

  Dave C.



Tue, 06 Jul 1999 03:00:00 GMT  
 Need help with RANDOMIZE/RND

I am trying to make a program that prints a list of randomly selected
destinations and distances. I want to use the command RANDOM or RND command
to select destinations/distances, but I can't find out how to do it. I want
the user to first enter a "seed" and then the random number should be
written to a variable. Can anyone please help me with this one?

Regards,

Torje Str?m Evensen
--
"My grandfather used to say that a fella's life wasn't
worth mentioning if he hadn't shared with some people
along the way"
---Macgyver, giving his birthday speech



Tue, 06 Jul 1999 03:00:00 GMT  
 Need help with RANDOMIZE/RND

Quote:

> I am trying to make a program that prints a list of randomly selected
> destinations and distances. I want to use the command RANDOM or RND command
> to select destinations/distances, but I can't find out how to do it. I want
> the user to first enter a "seed" and then the random number should be
> written to a variable. Can anyone please help me with this one?

> Regards,

> Torje Str?m Evensen
> --
> "My grandfather used to say that a fella's life wasn't
> worth mentioning if he hadn't shared with some people
> along the way"
> ---Macgyver, giving his birthday speech

Why not use the system time as a seed,
ie.

Randomize timer

then assign variables...

You could use dimensional array variables to store the destinations...

dim dest$(20)  'sets up the variable 'space'

either store one by one;

let dest$(1)="Tokyo"
let dest$(2)="Montreal"

etc.

or use data/read statements...

for n=1 to 20
        read dest$(n)
next n

data "Tokyo","Montreal",etc....
(data at end of program...

I hope this helps...

Greg  :)



Tue, 06 Jul 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help Pls. Re: Randomize, Rnd

2. help with rnd and Randomize (Advanced level)

3. Rnd() and Randomize() Functions

4. Randomize and Rnd dont work?

5. Randomize and Rnd

6. Problems using Randomize, Rnd

7. rnd number check help needed

8. need help using RND for random numbers

9. need help randomizing on GWBASIC

10. I need help on randomizing variables

11. Need Help with Randomize

12. Desperate - need help with Randomize

 

 
Powered by phpBB® Forum Software