1Builtins.rand(3kaya)         Kaya module reference        Builtins.rand(3kaya)
2
3
4

NAME

6       Builtins::rand - Pseudo-random signed integer generator
7

SYNOPSIS

9       Int rand( )
10

DESCRIPTION

12       rand()  returns  a  pseudo-random  signed  integer  in  the  range  +/-
13       (2**31)-1
14
15       You must call Builtins.srand (3kaya) before  the  first  call  to  this
16       function in a program.
17
18
19    srand(12345);
20    for i in [1..5] {
21        putStr(rand()+" ");
22    }
23
24       Gives: 1995772607 -612336503 -885735441 457910745 1875493919
25
26       The  rand()  function  is a low-quality but fast generator - for better
27       quality numbers, use the optional Lfrand(3kaya) module or  for  crypto‐
28       graphic purposes, your computer's hardware RNG.
29

AUTHORS

31       Kaya   standard  library  by  Edwin  Brady,  Chris  Morris  and  others
32       (kaya@kayalang.org). For further information see http://kayalang.org/
33

LICENSE

35       The Kaya standard library is free software;  you  can  redistribute  it
36       and/or  modify  it  under  the  terms  of the GNU Lesser General Public
37       License (version 2.1 or any later version) as  published  by  the  Free
38       Software Foundation.
39
41       The Builtins.srand (3kaya) function
42       The Lfrand(3kaya) module
43
44
45
46Kaya                             December 2010            Builtins.rand(3kaya)
Impressum