I've seen gnu documentation for srandom that suggest the equivalent of Kevin's suggestion, namely "srandom(time(0))". Not sure if using the NSDate has any advantage over a call to time() and it would avoid this type of thing (gnu is likely to ensure time() and srandom() work correctly together).
Aaron On May 26, 2011, at 8:10 PM, Chase Latta wrote: > unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 10000.0); > > You are trying to set seed to a value that is something like > 3,281,585,690,000; seed cannot handle this value so it will be set to > 4294967295, at least on my machine. > > You are using the same seed each time you run the program so you are > getting the same values. Try getting rid of the "* 10000.0". > > Chase > > On Thu, May 26, 2011 at 7:15 PM, Kevin Bracey <ke...@ilike.co.nz> wrote: >> I think this was from some programming book I have, sorry I can site it: >> >> srandom(time(NULL)); >> >> cheers >> Kevin >> >> >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> 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: >> http://lists.apple.com/mailman/options/cocoa-dev/chaselatta%40gmail.com >> >> This email sent to chasela...@gmail.com >> > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/eeyore%40monsterworks.com > > This email sent to eey...@monsterworks.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com