Changeset 17934 in project


Ignore:
Timestamp:
04/26/10 19:56:33 (9 years ago)
Author:
Jim Ursetto
Message:

wiki/Unit extras: Comment on randomness quality of RANDOM.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/man/4/Unit extras

    r17912 r17934  
    3434<procedure>(random N)</procedure>
    3535
    36 Returns a random {{integer}} in {{[0 N-1]}}. {{N}} is an {{integer}}.
    37 
    38 On '''Windows''' {{N}} and the random value are {{exact integer}}.
    39 
     36Returns a pseudo-random {{integer}} in {{[0, N-1]}}. {{N}} is an {{integer}}.
     37
     38On Windows, {{N}} and the random value are {{exact integer}}.
     39
     40'''Warning''': This procedure uses ''rand(3)'' internally and exhibits
     41its deficiencies, including low quality pseudo-randomness:
     42
     43* On Windows and Solaris, only 32768 unique random values can be
     44generated in the range {{[0, N-1]}}.  If {{N >= 32768}}, there
     45will be gaps in the result set.
     46* On Mac OS X, Windows and some other platforms, little variance in output is seen
     47with nearby seeds.  Since the random generator is seeded
     48with {{current-seconds}} at startup, new processes may see similar or
     49identical random sequences for up to a minute.
     50* On Linux, ''rand(3)'' is an alias to ''random(3)'', which provides
     51output of reasonable quality.
    4052
    4153
Note: See TracChangeset for help on using the changeset viewer.