Re: repeatable random numbers in an object
Re: repeatable random numbers in an object
- Subject: Re: repeatable random numbers in an object
- From: Michael Ash <email@hidden>
- Date: Wed, 17 Jun 2009 15:16:18 -0400
On Wed, Jun 17, 2009 at 1:05 PM, Kyle Sluder<email@hidden> wrote:
> On Wed, Jun 17, 2009 at 9:54 AM, Kirk Kerekes<email@hidden> wrote:
>> <http://www-cs-faculty.stanford.edu/~knuth/programs/rng.c>
>
> Not to knock on Don Knuth, but I wouldn't recommend using that code in
> your app. There's a perfectly good RNG facility in the system as Mr.
> George Warner pointed out, and Knuth's code is designed for a 32-bit
> system. While it will work on OS X (because we use LP64), it will be
> wrong on Win64 (which uses ILP64) and will cause problems if you
> upcast to NSUInteger on OS X.
Nitpick: Windows is actually LLP64 (int and long are 32, long long and
pointers are 64) and so it will work fine there.
This is not to detract from your overall point in any way. If your
code needs precise sizes, use a data type which specifies the size
explicitly, like the standard int32_t and friends in stdint.h.
Mike
_______________________________________________
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