Re: rand() and srand() broken?
Re: rand() and srand() broken?
- Subject: Re: rand() and srand() broken?
- From: Jason Foreman <email@hidden>
- Date: Wed, 25 Nov 2009 11:47:49 -0600
On Nov 25, 2009, at 11:26 AM, Derek Gaston wrote:
> This piece of code should generate 100 random numbers between 0 and 1... I am expecting that they be fairly spaced out as well...
What basis do you have for this expectation? Is it spelled out in any specification or standard somewhere?
You're seeding the RNG with a monotonically increasing seed, and getting what looks like monotonically increasing starting values for your random sequences. The fact that you get what you expect on Linux seems to be purely coincidental.
> This is actually indicative of what we actually do in one of our applications (I know it doesn't usually make much sense to reseed all the time... but you're just going to have to trust me that it's necessary in our case ;-)
I think you're going to have to explain why you feel reseeding is necessary. You probably shouldn't be doing it.
Jason
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden