Improved the seeding algorithm. Old behaviour can be achived by setting

2002-11-26  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* glib/grand.c, gthread/gthread-impl.c, tests/rand-test.c:
	Improved the seeding algorithm. Old behaviour can be achived by
	setting envvar G_RANDOM_VERSION to "2.0". (#99262)

	* docs/reference/glib/glib-docs.sgml,
	docs/reference/glib/Makefile.am: Renamed
	docs/reference/glib/changes-2.0.sgml to
	docs/reference/glib/changes.sgml and added section for changes
	from 2.0 to 2.2 (Also corrected 1.0 to 1.2).

	* README.in, docs/reference/glib/running.sgml,
	docs/reference/glib/tmpl/random_numbers.sgml,
	docs/reference/glib/changes.sgml: Added notes about the new
	seeding algorithm.
This commit is contained in:
Sebastian Wilhelmi
2002-11-26 14:09:00 +00:00
committed by Sebastian Wilhelmi
parent 17344bb1e4
commit c838b2a071
16 changed files with 281 additions and 50 deletions

View File

@@ -48,7 +48,7 @@ HTML_IMAGES = \
content_files = \
running.sgml \
building.sgml \
changes-2.0.sgml \
changes.sgml \
compiling.sgml \
resources.sgml \
version.xml

View File

@@ -1,26 +1,58 @@
<refentry id="glib-changes-2-0" revision="17 Jan 2002">
<refentry id="glib-changes" revision="17 Jan 2002">
<refmeta>
<refentrytitle>Changes from 1.0 to 2.0</refentrytitle>
<refentrytitle>Changes to GLib</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>Changes from 1.0 to 2.0</refmiscinfo>
<refmiscinfo>Changes to GLib</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Changes from 1.0 to 2.0</refname>
<refname>Changes to GLib</refname>
<refpurpose>
Incompatible changes made between version 1.0 and version 2.0
Incompatible changes made between successing versions of GLib
</refpurpose>
</refnamediv>
<refsect1>
<title>Incompatible changes from 1.0 to 2.0</title>
<title>Incompatible changes from 2.0 to 2.2</title>
<itemizedlist>
<listitem>
<para>
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.
</para>
<para>
Further information can be found at the website of the Mersenne
Twister random number generator at <ulink
url="http://www.math.keio.ac.jp/~matumoto/emt.html">http://www.math.keio.ac.jp/~matumoto/emt.html</ulink>.
</para>
<para>
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.
</para>
</listitem>
</itemizedlist>
</refsect1>
<refsect1>
<title>Incompatible changes from 1.2 to 2.0</title>
<para>
The <ulink url="http://developer.gnome.org/dotplan/porting/">GNOME 2.0
porting guide</ulink> on <ulink
url="http://developer.gnome.org">http://developer.gnome.org</ulink>
has some more detailed discussion of porting from 1.0 to 2.0.
has some more detailed discussion of porting from 1.2 to 2.0.
See the section on GLib.
</para>

View File

@@ -58,7 +58,7 @@
<!ENTITY glib-Building SYSTEM "building.sgml">
<!ENTITY glib-Running SYSTEM "running.sgml">
<!ENTITY glib-Resources SYSTEM "resources.sgml">
<!ENTITY glib-Changes-2-0 SYSTEM "changes-2.0.sgml">
<!ENTITY glib-Changes SYSTEM "changes.sgml">
<!ENTITY version SYSTEM "version.xml">
]>
@@ -107,7 +107,7 @@ implementations, e.g. POSIX threads, DCE threads or Solaris threads.
&glib-Building;
&glib-Compiling;
&glib-Running;
&glib-Changes-2-0;
&glib-Changes;
&glib-Resources;
</chapter>

View File

@@ -62,6 +62,17 @@ variables like <envar>LANG</envar>, <envar>PATH</envar> or <envar>HOME</envar>.
</para>
</formalpara>
<formalpara>
<title><envar>G_RANDOM_VERSION</envar></title>
<para>
If this environment variable is set to '2.0', the outdated
pseudo-random number seeding algorithm from GLib-2.0 is used
instead of the new better one. Use the GLib-2.0 algorithm only if
you have sequences of numbers generated with Glib-2.0 that you
need to reproduce exactly.
</para>
</formalpara>
</refsect2>
<refsect2>

View File

@@ -2,12 +2,12 @@
Random Numbers
<!-- ##### SECTION Short_Description ##### -->
pseudo random number generator.
pseudo-random number generator.
<!-- ##### SECTION Long_Description ##### -->
<para>
The following functions allow you to use a portable, fast and good
pseudo random number generator (PRNG). It uses the Mersenne Twister
pseudo-random number generator (PRNG). It uses the Mersenne Twister
PRNG, which was originally developed by Makoto Matsumoto and Takuji
Nishimura. Further information can be found at <ulink
url="http://www.math.keio.ac.jp/~matumoto/emt.html"
@@ -32,6 +32,18 @@ equally distributed random numbers, whereas for example the
yield equally distributed numbers.
</para>
<para>
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.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>