
Randomize Timer function not working
Quote:
> > Why?
> Remove the Randomize Timer command from inside your loops.
> In fact remove them all and place 1 in the form's initialize event.
Thought you might want some insight into what's happening. The Randomize
Timer command uses the current system time to create a seed for the random
number generator (Rnd). Every time that you call Rnd, it will create a new
random number. You need to seed it only once so that the sequence of
"random" numbers that you get isn't the same each time that you run the
application.
In your case, it is quite possible that your code is running fast enough
that the Randomize Timer call is occurring multiple times in a single clock
tick. This results in the random number generator being re-seeded with the
same original seed, thereby causing the next call to Rnd to produce the
same random number.
You need only seed the random number generator once. I recommend that you
place your Randomize function inside the Form_Load event and forget about
it after that!
Jason White
Software Engineer
National Instruments
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X X
X Check out ComponentWorks, a collection of ActiveX controls from X
X National Instruments for PC Measurement and Automation. Information X
X and free demo at http://www.natinst.com/cworks/ X
X X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX