[REBOL] Re: Question and comment about randomizing a block of values
From: joel:neely:fedex at: 19-Jun-2001 10:05
Thanks for the hint!
Not a stupid question at all ...
Jeff Kreis wrote:
> Sorry to ask a stupid question, but what's wrong with:
> random/seed now/time
> c: 0
> x: random reduce head insert/dup copy  [c: c + 1] 52
> ; -- produces a block of 1 - 52 randomly ordered
> > > shuffled-iota1: func [n [integer!] /local m f c r] [
> . . .
... but I guess I'm the stupid one.
>> ? random
RANDOM value /seed /secure /only
Returns a random value of the same datatype.
RANDOM is an action value.
value -- Maximum value of result (Type: any)
/seed -- Restart or randomize
/secure -- Returns a cryptographically secure random number.
/only -- Return single value from series.
Having seen your example (I like the INSERT/DUP trick, BTW) I
can now be reminded of it by the hints in HELP output, but I
think it would have taken me a VERRRRY long time to make the leap
in the other direction and think of trying that from the way that
RANDOM is described.
Ah, well... That's how we learn!
___ ___ ___
\/ 2 + \/ 2 = 4 (for sufficiently large approximations of \/ 2 )