From rhoekstr@wins.uva.nl Tue Feb 20 15:04:01 2001
Received: from paulus.lri.jur.uva.nl (paulus.lri.jur.uva.nl [145.18.104.201])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f1KE41Z08245
	for <prolog@swi.psy.uva.nl>; Tue, 20 Feb 2001 15:04:01 +0100 (MET)
Received: from rein (rein [145.18.104.211])
	by paulus.lri.jur.uva.nl (8.10.2/8.10.2) with SMTP id f1KE40D02054
	for <prolog@swi.psy.uva.nl>; Tue, 20 Feb 2001 15:04:00 +0100 (MET)
Reply-To: <rhoekstr@science.uva.nl>
From: "R. Hoekstra" <rhoekstr@wins.uva.nl>
To: "Prolog Mailing List" <prolog@swi.psy.uva.nl>
Subject: [SWIPL] How to generate a random number?
Date: Tue, 20 Feb 2001 15:03:59 +0100
Message-ID: <PLEOINJCJDFINLIJDJBMKENLCFAA.rhoekstr@wins.uva.nl>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Importance: Normal

Hi David,

doing an 'apropos(random).' query will give the following result:

random/1                      Generate random number

doing a 'help(random).'will give the following result:

random(+Int)
    Evaluates to a random integer i for which 0 i< Int. The seed of this
random generator is determined by the system clock when SWI-Prolog was
started.

Thus, generating a random number 0=<I<100 in Prolog is done by the following
query:

I is random(100).

Regards,

	Rinke Hoekstra


-----Original Message-----
From: David Yang [mailto:sunriseat28@yahoo.com]
Sent: dinsdag 20 februari 2001 14:38
To: prolog@swi.psy.uva.nl
Subject: [SWIPL] How to generate a random number?



How to generate a random number, say between 1 and
100, in SWI-Prolog?


David

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/


----------------
* To UNSUBSCRIBE, please use the HTML form at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist

or send mail to prolog-request@swi.psy.uva.nl using the Subject:
"unsubscribe"
(without the quotes) and *no* message body.

** An ARCHIVE of this list is maintained at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/


