<HTML> <HEAD> <!-- Created by texi2html 1.56k + clip patches and <A href="http://www.clip.dia.fi.upm.es/Software">lpdoc</A> from ciao.texi on 28 January 2007 --> <LINK rel="stylesheet" href="ciao.css" type="text/css"> <TITLE>The Ciao Prolog System - Random numbers</TITLE> </HEAD> <BODY> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_173.html">previous</A>, <A HREF="ciao_175.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. <P><HR><P> <H1><A NAME="SEC714" HREF="ciao_toc.html#TOC714">Random numbers</A></H1> <P> <A NAME="IDX7990"></A> <P> <STRONG>Author(s):</STRONG> Daniel Cabeza. <P> <STRONG>Version:</STRONG> 1.10#7 (2006/4/26, 19:22:13 CEST) <P> <STRONG>Version of last change:</STRONG> 1.9#275 (2004/1/9, 16:25:9 CET) <P> This module provides predicates for generating pseudo-random numbers <UL> <LI><A HREF="ciao_174.html#SEC715">Usage and interface (random)</A> <LI><A HREF="ciao_174.html#SEC716">Documentation on exports (random)</A> </UL> <H2><A NAME="SEC715" HREF="ciao_toc.html#TOC715">Usage and interface (<CODE>random</CODE>)</A></H2> <div class="cartouche"> <UL> <LI><STRONG>Library usage:</STRONG> <CODE>:- use_module(library(random)).</CODE> <LI><STRONG>Exports:</STRONG> <UL> <LI><EM>Predicates:</EM> <A NAME="IDX7991"></A> <CODE>random/1</CODE>, <A NAME="IDX7992"></A> <CODE>random/3</CODE>, <A NAME="IDX7993"></A> <CODE>srandom/1</CODE>. </UL> </UL> </div class="cartouche"> <H2><A NAME="SEC716" HREF="ciao_toc.html#TOC716">Documentation on exports (<CODE>random</CODE>)</A></H2> <P> <A NAME="IDX7994"></A> <A NAME="IDX7995"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>random/1:</B> <DD><A NAME="IDX7996"></A> <P> <CODE>random(Number)</CODE> <P> <CODE>Number</CODE> is a (pseudo-) random number in the range [0.0,1.0] </DL> <P> <A NAME="IDX7997"></A> <A NAME="IDX7998"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>random/3:</B> <DD><A NAME="IDX7999"></A> <P> <CODE>random(Low, Up, Number)</CODE> <P> <CODE>Number</CODE> is a (pseudo-) random number in the range [<CODE>Low</CODE>, <CODE>Up</CODE>] <P> <STRONG>Usage 1:</STRONG> <CODE>random(+int, +int, -int)</CODE> <UL> <LI><EM>Description:</EM> If <CODE>Low</CODE> and <CODE>Up</CODE> are integers, <CODE>Number</CODE> is an integer. </UL> </DL> <P> <A NAME="IDX8000"></A> <A NAME="IDX8001"></A> <DL> <DT><span class="define">PREDICATE:</span> <B>srandom/1:</B> <DD><A NAME="IDX8002"></A> <P> <CODE>srandom(Seed)</CODE> <P> Changes the sequence of pseudo-random numbers according to <CODE>Seed</CODE>. The stating sequence of numbers generated can be duplicated by calling the predicate with <CODE>Seed</CODE> unbound (the sequence depends on the OS). </DL> <P><HR><P> Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_173.html">previous</A>, <A HREF="ciao_175.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>. </BODY> </HTML>