[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Unexpected randomseed results (was [ANN] uuid: pure Lua uuid generator)
- From: Sean Conner <sean@...>
- Date: Sat, 11 May 2013 04:23:28 -0400
It was thus said that the Great Sean Conner once stated:
>
> Or perhaps:
>
> double ds = luaL_checknumber(L,1);
> unsigned int s;
>
> if (ds < 1.0)
> s = (unsigned int)(ds * (double)UINT_MAX);
> else if (ds > UINT_MAX)
> s = (unsigned int)fmod(ds,UINT_MAX);
> else
> s = (unsigned int)ds;
>
> srand(ds);
I need an editor. I mean
srand(s);
-spc (Sigh)