emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: random doesn't feel very random


From: Stefan Monnier
Subject: Re: random doesn't feel very random
Date: Mon, 27 Aug 2012 00:48:47 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

> It is a feature that, if you don't call (random t), `random' returns
> a predictable sequence.  That is good for debugging.

I wonder how often this has been useful.  Since most/any package that
uses `random' will want the sequence to be unpredictable, many packages
call (random t) at various times, so before you can benefit from such
a feature, you'll need to disable those (random t) that would otherwise
get in the way.

It would be much simpler to always seed the PRNG at startup from
"unpredictable" data and then provide a (random-seed N) which you can
call explicitly to reset the PRNG to a predictable state if/when you
need it for debugging.

> Perhaps we should create a different interface for that feature
> and make the default truly random.

Exactly (for some value of "truly random").


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]