site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Nov 14, 2007, at 12:04 PM, darwin-dev-request@lists.apple.com wrote: int32_t seed=(int32_t)(time(NULL) & 0xff); srandom(seed); That seems more like the least-significant 8 bits. = Mike _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... 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. This email sent to site_archiver@lists.apple.com
participants (1)
-
Michael Smith