[ Previous ] [ Contents ] [ Index ] [ Next ]

ns_rand

Overview

Generate a random number

Syntax

ns_rand ?max?

Description

This function generates a random number. If max is not specified, the random number is a floating-point value ranging from 0.0 to less than 1.0. If max is specified, the random number is an integer value ranging from 0 to one less than max. The max argument must be a positive number no larger than 2147483647 (0x7fffffff).

ns_rand is implemented with the drand48(3) and lrand48(3) standard library functions. An internal random seed is generated the first time ns_rand is called after the server is started.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1998-99 America Online, Inc.