Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
random numbers
#2
(10-20-2007, 09:28 PM)MN link Wrote:looking to generate random numbers from 0-9

randomize timer
for i=1 to 50: print int(rnd*10);: next i: print

This will generate 50 random numbers and the series will be different the next time you run the program because of the randomize timer statement at the beginning of the program.

But note also that by the nature of random numbers, I could theoretically generate all 50 and not get a 0 or a 7 or any other given digit. It is a bit like flipping a coin: you could get 50 heads.

If what you want is all 10 digits, 0-9, in random order with each digit appearing exactly once, ask again. That is a different technique.

Mac
Reply


Messages In This Thread
random numbers - by MN - 10-20-2007, 09:28 PM
Re: random numbers - by Mac - 10-21-2007, 12:19 AM
Re: random numbers - by Mac - 10-21-2007, 12:24 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)