Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.lisp > #60792

Re: Make a random-state from a non-random source

From Stefan Monnier <monnier@iro.umontreal.ca>
Newsgroups comp.lang.lisp
Subject Re: Make a random-state from a non-random source
Date 2026-05-11 11:23 -0400
Organization A noiseless patient Spider
Message-ID <jwvv7cu2cst.fsf-monnier+comp.lang.lisp@gnu.org> (permalink)
References <jwvmryfku8t.fsf-monnier+comp.lang.lisp@gnu.org> <10tntu1$3r6q9$1@dont-email.me>

Show all headers | View raw


tfb [2026-05-09 18:20:49] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> I guess I could print a random state into a file and then read it back in,
>> but that depends on internals, so it's doubly messy.
> It only depends on internals in the sense that you don't know what the
> details of a random-state object are.  You *do* know that printing and then
> reading one results in an equivalent object.
>
> So all you need to do is (inside with-standard-io-syntax if need be) is
> print one.  Then you can simply say
>
> (defvar *my-random-state*
>   #+<impl>
>   <paste thing you just printed>
>   ... versions for any other implementations ...
>   #-(or <impl> ...)
>   (error "add a case"))

Hmm... interesting.  So that a case where the availability of
reader-level conditionals has influenced the design of a "primitive".
Thanks,


=== Stefan

Back to comp.lang.lisp | PreviousPrevious in thread | Find similar


Thread

Make a random-state from a non-random source Stefan Monnier <monnier@iro.umontreal.ca> - 2026-05-04 12:46 -0400
  Re: Make a random-state from a non-random source Alan Bawden <alan@csail.mit.edu> - 2026-05-05 00:45 -0400
    Re: Make a random-state from a non-random source Stefan Monnier <monnier@iro.umontreal.ca> - 2026-05-05 16:03 -0400
  Re: Make a random-state from a non-random source tfb <no_email@invalid.invalid> - 2026-05-09 18:20 +0000
    Re: Make a random-state from a non-random source Stefan Monnier <monnier@iro.umontreal.ca> - 2026-05-11 11:23 -0400

csiph-web