unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon Leinen <simon.leinen@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Achim Gratz <Stromeko@nexgo.de>, emacs-devel@gnu.org
Subject: Re: random doesn't feel very random
Date: Mon, 27 Aug 2012 08:31:53 +0200	[thread overview]
Message-ID: <CAAO6KgCRALUiShJ7eyBFhWmZV9RSC3_Kv3LDhoJVh9uiE8bDuQ@mail.gmail.com> (raw)
In-Reply-To: <jwvsjb9mabt.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

On Mon, Aug 27, 2012 at 2:50 AM, Stefan Monnier <monnier@iro.umontreal.ca>wrote:

> > Therefore the PRNG should be seeded once at start-up, from a good
> > source of entropy.
>
> IIRC Emacs fails to seed its PRNG at start (IOW it is seeded with
> a constant), which is why many packages use (random t).
>
> So I think the right thing to do now is to do seed it at startup, then
> make (random t) a no-op.
>
> We could consider adding a way to get the PRNG state and reset it later,
> but since the PRNG state is Emacs-wide and Emacs is more like an OS than
> like an application w.r.t its packages, such an interface would need to
> allow several named PRNGs, so you'd call (random N <id>) to get the next
> "random" number from <id>'s stream.


What about implementing the Common Lisp conventions for treating PRNG
state, i.e. an optional state argument to RANDOM, and a variable
*RANDOM-STATE*?
Instead of (RANDOM T), people could say something like (SETQ *RANDOM-STATE*
(MAKE-RANDOM-STATE T)) if they really want.
-- 
Simon.

[-- Attachment #2: Type: text/html, Size: 1401 bytes --]

  reply	other threads:[~2012-08-27  6:31 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24  5:47 random doesn't feel very random Ivan Kanis
2012-08-24  6:22 ` Tassilo Horn
2012-08-24 17:19   ` random doesn't feel very random, random doesn't feel very random, " Ivan Kanis
2012-08-24 18:50     ` Stephen J. Turnbull
2012-08-25  7:46       ` Ivan Kanis
2012-08-24  6:30 ` Leo
2012-08-24 22:48   ` Richard Stallman
2012-08-24 22:57     ` Andreas Schwab
2012-08-25 20:55       ` Richard Stallman
2012-08-25 23:25         ` Leo
2012-08-26 13:12           ` Richard Stallman
2012-08-26 14:24             ` Achim Gratz
2012-08-26 23:22               ` Leo
2012-08-27  0:50               ` Stefan Monnier
2012-08-27  6:31                 ` Simon Leinen [this message]
2012-08-27  3:41               ` Richard Stallman
2012-08-27  4:48                 ` Stefan Monnier
2012-08-31  9:41                   ` Eli Zaretskii
2012-08-31 15:06                     ` Stefan Monnier
2012-08-31 15:23                       ` chad
2012-08-31 17:50                       ` Eli Zaretskii
2012-08-31 19:43                         ` Stefan Monnier
2012-09-01  1:18                           ` Paul Eggert
2012-09-01  7:19                             ` Achim Gratz
2012-09-01 13:19                               ` Paul Eggert
2012-09-04 19:19                                 ` Nix
2012-09-04 20:07                                   ` Paul Eggert
2012-09-04 20:11                                     ` Nix
2012-09-02 12:27                               ` Jason Rumney
2012-09-02 13:08                                 ` Stefan Monnier
2012-09-01  7:22                             ` Ivan Kanis
2012-09-01 11:13                             ` joakim
2012-08-31 23:04                       ` Leo
2012-08-27  5:17                 ` Achim Gratz
2012-08-31  9:42                   ` Eli Zaretskii
2012-08-31 15:07                     ` Stefan Monnier
2012-08-31 17:50                       ` Eli Zaretskii
2012-08-26  9:06         ` Ivan Kanis
2012-08-24  7:03 ` Stephen J. Turnbull
2012-08-24  9:10   ` Paul Eggert
2012-08-24 17:45     ` Stephen J. Turnbull
2012-08-24 12:45 ` OT: appropriateness of "random" for playlist generation (was: random doesn't feel very random) Jeremiah Dodds
2012-08-24 14:37 ` random doesn't feel very random Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAO6KgCRALUiShJ7eyBFhWmZV9RSC3_Kv3LDhoJVh9uiE8bDuQ@mail.gmail.com \
    --to=simon.leinen@gmail.com \
    --cc=Stromeko@nexgo.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).