random generator

Karl Hasselström kha@treskal.com
Thu, 31 Oct 2002 16:45:10 +0100


--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2002-10-31 16:32:01 +0000, Francesco Tonolli wrote:
>
> Can you explain me the right way to make a random number??

(Pseudo-)Random generators in programs generally start with one value
called a seed value, then compute the next value from that (in a
completely deterministic manner), then compute the next value from
that, etc. To get different pseudorandom sequences every time you run
the program, you must provide the generator with a different seed
value each time, for example the current time.

It seems from your description that Pascal does this for you. GMP does
not; you have to do that yourself by calling one of the functions
described in the "Random State Seeding" section of the manual.

--=20
Kalle Hasselstr=F6m, kha@treskal.com
      www.treskal.com/kalle

--fdj2RfSjLxBAspz7
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9wVAGN7iPzXSoOQoRAkb2AJ9HSCzMYElzFeo/4tYpzbhSh/sddQCfVf3B
/b11eKBFyS7K5QHeDSI8P/k=
=jzVJ
-----END PGP SIGNATURE-----

--fdj2RfSjLxBAspz7--