Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In many random functions you have to seed it to get a really random
first number.You do this with the date or something like that. How does rnd work? Does it always produce the same sequence of random numbers or does it somehow seed itself to start randomly? John |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the VBA help file they have the following advisory.
For any given initial seed, the same number sequence is generated because each successive call to the Rnd function uses the previous number as a seed for the next number in the sequence. Before calling Rnd, use the Randomize statement without an argument to initialize the random-number generator with a seed based on the system timer. It also depends on how large your universe is that you are trying to randomize. "John" wrote: In many random functions you have to seed it to get a really random first number.You do this with the date or something like that. How does rnd work? Does it always produce the same sequence of random numbers or does it somehow seed itself to start randomly? John |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks... I should have checked that.
John JLGWhiz wrote: In the VBA help file they have the following advisory. For any given initial seed, the same number sequence is generated because each successive call to the Rnd function uses the previous number as a seed for the next number in the sequence. Before calling Rnd, use the Randomize statement without an argument to initialize the random-number generator with a seed based on the system timer. It also depends on how large your universe is that you are trying to randomize. "John" wrote: In many random functions you have to seed it to get a really random first number.You do this with the date or something like that. How does rnd work? Does it always produce the same sequence of random numbers or does it somehow seed itself to start randomly? John |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use the "randomize" statement immediately before calling the
Rnd function to seed the function. Do not use randomize inside a loop or you can get non-random patterns. It does not make all statisticians happy with its performance. The WorksheetFunction.Rand function is preferred by some. Do a search (in the programming group) for "Bias in rnd for excel 07" for some discussion on the issue. -- Jim Cone Portland, Oregon USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins - free Special Randoms workbook - no registration required) "John" wrote in message In many random functions you have to seed it to get a really random first number.You do this with the date or something like that. How does rnd work? Does it always produce the same sequence of random numbers or does it somehow seed itself to start randomly? John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Random phantom breakpoints and random bogus compile errors | Excel Programming | |||
Sorting random Data created from a random formula | Excel Discussion (Misc queries) | |||
Non-random numbers generated by excel's data analysis random gener | Excel Worksheet Functions | |||
Non-random numbers generated by excel's data analysis random gener | Excel Discussion (Misc queries) | |||
How do I find random number in list of random alpha? (Position is. | Excel Discussion (Misc queries) |