Improve generation of pseudo-random integers. (#99720, Morten Welinder

2002-12-10  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

        * glib/grand.c (g_rand_int_range): Improve generation of
        pseudo-random integers. (#99720, Morten Welinder <terra@diku.dk>)

        * README.in, docs/reference/glib/running.sgml,
        docs/reference/glib/tmpl/random_numbers.sgml,
        docs/reference/glib/changes.sgml: Added notes about the new
        algorithm.
This commit is contained in:
Sebastian Wilhelmi
2002-12-10 13:51:06 +00:00
committed by Sebastian Wilhelmi
parent 1c462ac694
commit df9d9332f8
2 changed files with 67 additions and 33 deletions

View File

@@ -36,12 +36,18 @@ yield equally distributed numbers.
GLib changed the seeding algorithm for the pseudo-random number
generator Mersenne Twister, as used by <structname>GRand</structname>
and <structname>GRandom</structname>. This was necessary, because some
seeds would yield very bad pseudo-random streams. The original seeding
algorithm, as found in GLib 2.0.x, can be used instead of the new one
by setting the environment variable <envar>G_RANDOM_VERSION</envar> to
the value of '2.0'. Use the GLib-2.0 algorithm only if you have
sequences of numbers generated with Glib-2.0 that you need to
reproduce exactly.
seeds would yield very bad pseudo-random streams. Also the
pseudo-random integers generated by
<function>g_rand*_int_range()</function> will have a
slightly better equal distribution with the new version of GLib.
</para>
<para>
The original seeding and generation algorithms, as found in GLib 2.0.x,
can be used instead of the new ones by setting the environment variable
<envar>G_RANDOM_VERSION</envar> to the value of '2.0'. Use the
GLib-2.0 algorithms only if you have sequences of numbers generated
with Glib-2.0 that you need to reproduce exactly.
</para>
<!-- ##### SECTION See_Also ##### -->