random-units ( length -- sequence ) (original) (raw)

random-units ( length -- sequence )
Generating random integers

Prev: random-bytes ( n -- byte-array )
Next: random-bits ( numbits -- n )

Vocabulary
random

Inputs

length an integer

Outputs

sequence an array

Word description
Outputs an array with length random uniform floats from [0,1].

Examples

USING: prettyprint random ; 7 random-units .
{ 0.1881956429982787 0.9063571897519639 0.9550470241550406 0.6289397941552234 0.9441213853903183 0.7673290082934152 0.573743749061385 }

Definition

USING: kernel namespaces sequences ;

IN: random

: random-units ( length -- sequence )
random-generator get [ random-unit* ] curry replicate ;