• 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: 64-bit srandom()?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 64-bit srandom()?


  • Subject: Re: 64-bit srandom()?
  • From: Michael Smith <email@hidden>
  • Date: Thu, 15 Nov 2007 12:28:05 -0800


On Nov 14, 2007, at 12:04 PM, email@hidden wrote:

int32_t seed=(int32_t)(time(NULL) & 0xff);
srandom(seed);

That seems more like the least-significant 8 bits.

Note that strictly speaking, seeding srandom with time may not be exactly
secure, but then, srandom's not a cryptographically secure RNG anyway.

More to the point, the *only* time you want to use srandom() is when you want a reproducible set of pseudo-random numbers.


If your original objective was to obtain random numbers, you should be reading bytes from /dev/random or similar.

 = Mike

_______________________________________________
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


  • Prev by Date: Re: 64-bit srandom()?
  • Next by Date: libcrypto and libssl arch issue
  • Previous by thread: Re: 64-bit srandom()?
  • Next by thread: libcrypto and libssl arch issue
  • Index(es):
    • Date
    • Thread