unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Improve `seed->random-state' in stable-2.0?
@ 2012-01-20  3:28 Mark H Weaver
  2012-01-20  8:37 ` David Kastrup
  2012-01-20 14:54 ` Andy Wingo
  0 siblings, 2 replies; 15+ messages in thread
From: Mark H Weaver @ 2012-01-20  3:28 UTC (permalink / raw)
  To: guile-devel

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



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-01-24  9:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20  3:28 Improve `seed->random-state' in stable-2.0? Mark H Weaver
2012-01-20  8:37 ` David Kastrup
2012-01-20 14:54 ` Andy Wingo
2012-01-20 18:52   ` Mark H Weaver
2012-01-20 20:35     ` Andy Wingo
2012-01-20 22:45       ` Mark H Weaver
2012-01-21  7:38         ` David Kastrup
2012-01-21  8:20           ` Mark H Weaver
2012-01-23  9:52         ` Andy Wingo
2012-01-20 23:46       ` Mike Gran
2012-01-23  9:55         ` Andy Wingo
2012-01-23 13:06           ` Mike Gran
2012-01-23 14:06             ` Andy Wingo
2012-01-24  6:08               ` Mike Gran
2012-01-24  9:56                 ` Andy Wingo

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).