bongo-devel
[Top][All Lists]
Advanced

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

[bongo-devel] Re: 'Random' function failing to be random


From: Daniel Jensen
Subject: [bongo-devel] Re: 'Random' function failing to be random
Date: Mon, 02 Apr 2007 13:19:50 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

Anthony Chaumas-Pellet <address@hidden> writes:

> I'm not sure if the pseudo-random generator is supposed to be so
> predictable.

It is indeed supposed to be predictable. That way, you can repeat a
sequence of random numbers when debugging.

Don't use the return value of (random t), that is not how you do it
usually. It is used to generate a new seed. Use (random N) to control
the range.

Daniel Brockman <address@hidden> writes:

> Probably we shold call `(random t)' only once.  I'm not sure
> where, though.  Maybe we should just put it at the top level?

Yes, the top level would work. It might be better to call it when
random playback mode is set up. If you want to call it only once,
though I don't think it's strictly necessary, maybe use this:

(defun bongo-initialize-random ()
  (random t)
  (fset 'bongo-initialize-random 'ignore))

If that is too weird, use a variable `bongo-random-initialized'.





reply via email to

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