From: Damien Doligez <Damien.Doligez@inria.fr>
To: "Julien ÉLIE" <julien.elie@wanadoo.fr>
Cc: <caml-list@inria.fr>
Subject: Re: [Caml-list] Quelques questions sur Caml Light
Date: Tue, 15 Apr 2003 14:26:43 +0200 [thread overview]
Message-ID: <8494BEB5-6F3D-11D7-9BBA-0003930FCE12@inria.fr> (raw)
In-Reply-To: <001701c30331$28977040$0c1ffdc1@julien>
On Tuesday, April 15, 2003, at 11:26 AM, Julien ÉLIE wrote:
> 7°) À quoi sert la fonction « random__full_init » ?
> J'ai beau modifier la valeur donnée au « seed »,
> j'obtiens toujours la même séquence de nombres...
>
> random__full_init [|3;6|];;
> for i = 1 to 100 do
> print_int (random__int 1000);
> print_string " ";
> done;;
>
> renvoie les mêmes nombres que si j'avais auparavant fait :
> random__full_init [|5150;615|];;
> ou encore :
> random__full_init [|3;6;5;4;8;1;4;2;52;61|];;
Ce n'est pas exactement la meme sequence de nombres. En cherchant
bien, on trouve des differences.
> Je ne comprends pas très bien ce qui se passe...
Ce qui se passe, c'est que la fonction full_init prend en argument
un tableau de 55 entiers de 31 bits, et les utilise pour changer la
valeur initiale par defaut du generateur pseudo-aleatoire. Si vous
lui donnez un tableau de moins de 55 entiers ou des entiers plus petits
que 31 bits, elle fait de son mieux, mais vous risquez de changer des
bits de l'etat interne qui ne sont pas utilises pour generer des
nombres entre 0 et 1000.
-- Damien
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2003-04-15 12:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-15 9:26 Julien ÉLIE
2003-04-15 12:26 ` Damien Doligez [this message]
[not found] <010601c334d8$1c8d52f0$7115c7c2@inrialpes.fr>
2003-06-17 14:10 ` Jean-Baptiste Rouquier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8494BEB5-6F3D-11D7-9BBA-0003930FCE12@inria.fr \
--to=damien.doligez@inria.fr \
--cc=caml-list@inria.fr \
--cc=julien.elie@wanadoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox