home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource4
/
232_01
/
random.st
< prev
next >
Wrap
Text File
|
1987-06-17
|
512b
|
27 lines
Class Random
| seed |
[
new
seed <- 1
|
randomize
seed <- <TimeCounter>
|
first
^ <RandomFloat (seed <- <Random seed > ) >
|
next
^ <RandomFloat (seed <- <Random seed > ) >
|
between: low and: high
^ (self next * (high - low)) + low
|
randInteger: limit
^ (self next * limit) truncated + 1
|
next: n | newa |
newa <- Array new: n.
(1 to: n) do: [:x | newa at: x put: self next].
^ newa
]