Re: Best way to get a non-repeating random number?
Re: Best way to get a non-repeating random number?
- Subject: Re: Best way to get a non-repeating random number?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 14 Apr 2009 13:16:01 +0200
Le 14 avr. 09 à 13:08, WT a écrit :
On Apr 14, 2009, at 12:56 PM, Jean-Daniel Dupas wrote:
reading /dev/random is currently the best way to generate random
number on OS X.
http://lists.apple.com/archives/apple-cdsa/2009/Mar/msg00077.html
Yes, and those are *true* random numbers, since their source is
physical rather than algorithmic, that is, the numbers are generated
from random noise (thermal and electrical) read from physical devices.
For testing, though, it's always good to rely on a (good quality)
*pseudo*-random generator, so that you can reliably generate the
same sequences all the time.
Wagner
In this case, random() is a good candidate. And rand() should be avoid
as it is defined as a 'bad random number generator' according to its
man page.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden