[Top][All Lists]

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

Re: random doesn't feel very random

From: Eli Zaretskii
Subject: Re: random doesn't feel very random
Date: Fri, 31 Aug 2012 20:50:25 +0300

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden
> Date: Fri, 31 Aug 2012 11:06:45 -0400
> >> > 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.
> > ??? A pseudo-random sequence is always deterministic, that's what the
> > "pseudo" part is about.  I'm sure you already know that.
> Yes, obviously I know that.  So you've misunderstood what I said.


> I'm saying that I highly doubt that the fact that `random' always
> returns the exact same stream unless you explicitly call (random t)
> has been often useful (and used) for debugging in practice.

Not in Emacs, but in other software, the equivalent functionality has
proven useful to me many times.  You basically cannot debug software
that uses PRNG without this.  E.g., if two supposedly-identical runs
diverge at some point in the random numbers they show in some
variable, you _know_ you have a clue for debugging.

> As for whether they're bugs or not: I tend to agree that they're bugs,
> but since currently our PRNG is not automatically seeded, those packages
> that need their `random' to vary (IOW basically every package that
> uses random) have no other choice but to call (random t) explicitly at
> various times.

If you are trying to convince me that our PRNG should be seeded at
startup, them I'm sold on that a long time ago.

reply via email to

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