guile-devel
[Top][All Lists]
Advanced

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

Improve `seed->random-state' in stable-2.0?


From: Mark H Weaver
Subject: Improve `seed->random-state' in stable-2.0?
Date: Thu, 19 Jan 2012 22:28:13 -0500

Hello all,

`seed->random-state' is poorly implemented when passed a numeric
argument.  It converts the number to a decimal string, and then
`scm_i_init_rstate' takes over and basically adds every 8th byte
together to form the 64-bit internal state.

The problem is that only about 3-bits of entropy is present in each
character of the string, and then these are added together in an aligned
fashion, which also loses a great deal of entropy.  I haven't analyzed
this carefully, but I'd be surprised if we preserve much more than
32-bits of entropy from the original seed.

I know how to make this _much_ better, but here's the question: is it
okay to change the behavior of the random number generator in 2.0?  Or
is it important that the same sequence of random numbers are generated
from a given seed in the entire stable-2.0 series?

    Mark



reply via email to

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