Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

random

random

type: function (subr) 
location: built-in
source file: xlmath.c
Common LISP compatible: similar
supported on: all machines

SYNTAX

(random <expr> )
        <expr>          -       integer number/expression

DESCRIPTION

The RANDOM function generates and returns a random number between 0 and <expr> - 1. If <expr> is negative, the number range is forced to be positive.

EXAMPLES

(random 100)                            ; returns 7
(random 100)                            ; returns 49
(random 100)                            ; returns 73
(random -100)                           ; returns 58
(random 100.01)                         ; error: bad flt.pt. operation 

COMMON LISP COMPATIBILITY: Common LISP allows an optional state parameter, which is not supported in XLISP. Also, Common LISP allows floating point numbers, which XLISP does not support.

NOTE: This function is an extension of the XLISP system. It is provided in the MSSTUFF.C source code file. If your XLISP system is built for an IBM PC and compatibles, this function will work. If your system is built on UNIX or some other operating system, it will need the code in the corresponding STUFF.C file.


Go to the first, previous, next, last section, table of contents.