Subject: [SWIPL] How to generate a random number?

From: "R. Hoekstra" <[email-masked]>
Date: Tue, 20 Feb 2001 15:03:59 +0100

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:[email-masked]]
Sent: dinsdag 20 februari 2001 14:38
To: [email-masked]
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 [email-masked] 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/