• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Best way to get a non-repeating random number?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Best way to get a non-repeating random number? (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: "Luca C." <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: Uli Kusterer <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: "Luca C." <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: WT <email@hidden>)

  • Prev by Date: Re: Best way to get a non-repeating random number?
  • Next by Date: Re: typeFromFileExtension in Leopard SDK
  • Previous by thread: Re: Best way to get a non-repeating random number?
  • Next by thread: Re: Best way to get a non-repeating random number?
  • Index(es):
    • Date
    • Thread