Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Question and comment about randomizing a block of values

From: joel:neely:fedex at: 19-Jun-2001 10:05

Hi, Jeff, 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
USAGE: RANDOM value /seed /secure /only DESCRIPTION: Returns a random value of the same datatype. RANDOM is an action value. ARGUMENTS: value -- Maximum value of result (Type: any) REFINEMENTS: /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! -jn- ___ ___ ___ \/ 2 + \/ 2 = 4 (for sufficiently large approximations of \/ 2 ) joel'dot'neely'at'fedex'dot'com