Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr>
To: Patrice AUFFRET <patrice.auffret@hol.fr>
Cc: caml-list@inria.fr
Subject: Re: Nombre aléatoire.
Date: Fri, 22 May 1998 09:26:44 +0200	[thread overview]
Message-ID: <199805220726.JAA29258@pc85.lri.fr> (raw)
In-Reply-To: <35645902.27118F32@hol.fr>


> exécuté dans le toplevel ( sous Linux ). Mais lorsque je compile le
> programme, j'obtiens toujours le meme nombre. Le compilateur crée un
> nombre qu'il gardera de manière permanante lors de l'exécution
> ultérieure du programme. Comment faire pour qu'il change à chaque
> exécution du programme compilé ?

Une  façon simple  de faire consiste  à initialiser  le générateur  de
nombre aléatoires avec l'heure (donnée en nombre de secondes depuis le
1 janvier 1970, 00h00)

	Random.init (Unix.time())

-- 
Jean-Christophe FILLIATRE
  mailto:Jean-Christophe.Filliatre@lri.fr
  http://www.lri.fr/~filliatr





  reply	other threads:[~1998-05-23 22:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-21 16:40 Patrice AUFFRET
1998-05-22  7:26 ` Jean-Christophe Filliatre [this message]
1998-05-23 14:00 Damien Doligez

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=199805220726.JAA29258@pc85.lri.fr \
    --to=jean-christophe.filliatre@lri.fr \
    --cc=caml-list@inria.fr \
    --cc=patrice.auffret@hol.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