setting a random seed

Started by
10 comments, last by Crispy 20 years, 5 months ago
For this project I''m using VS .NET 2002 and I''ve landed on that srand() only has effect when called once per program instance. That is: if you were to call srand(time(NULL)) at the top of your program, any further calls to srand(MY_CONSTANT) will not generate a recurring output by rand(). Naturally, that''s a damn shame... The alternative, of course, is to use a custom-written random number generator, which I''m not prepared to do.
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Advertisement
it works correctly on my compiler (BCC55)...

you could try the "mersenne twister" (google for it) if you don''t want to work out your own random number algorithm.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])

This topic is closed to new replies.

Advertisement