[m-rev.] time additions (was Re: for review: Add random.init/3)

Paul Bone paul at bone.id.au
Thu May 26 14:25:32 AEST 2016

On Thu, May 26, 2016 at 12:15:52PM +1000, Julien Fischer wrote:
> > 
> > My reaction to the use of floats for this kind of thing is rater visceral.
> > 
> > I agree that it may be useful to expose time in seconds since the epoch for
> > other reasons.  And as an aside, gettimeofday() could be useful if portable
> > too.
> > 
> > I think there are a few potential solutions.
> > 
> >  1 Use an int and hope for the best for 32-bit C / Java and C# platforms.
> Can we do a little better than hoping for the best?
> >    Maybe the world will end before 2038 and we'll also never need to store
> Or assuming that world will end before 2038 ...

Partly I'm being facetious and partly this is a serious proposal because...

> ...
> 4. Seed the PRNG using something other than time, for example:

...obviously this is the best solution in addition to generally improving
the random and time modules etc.  However I'm also concerned that I/we won't
finish this before the next task needs our attention.  "just using ints" is
something that can be implemented easily and is going to make it easier to
seed the random number generator, even if the seed isn't secure, or the
generator itself isn't strong.  We can always come back later and make

Paul Bone

More information about the reviews mailing list