Hi Donald

With Rebol, you can use random directly on a block of string to get the same
block randomized.

colors: ["red" "green" "yellow" "blue" "white"]
while [not tail? colors] [
    colors: random colors
    print first colors
    remove colors
]

;blue
;yellow
;green
;red
;white

HTH

Patrick
----- Original Message -----
From: "Donald Dalley" <[EMAIL PROTECTED]>
To: "Mail List REBOL" <[EMAIL PROTECTED]>
Sent: Sunday, January 20, 2002 1:03 AM
Subject: [REBOL] RANDOM's & PICK's args


> Hi, REBOLs:
>
> I am trying to PICK a set (say 3-9) of random, non-duplicated strings out
> of a block of 50. The strings are to be presented as a row of BUTTONs.
> BUTTON needs a string...
>
> How do we use >both< a RANDOM range and a seed, at the same time?
> The docs don't show how and all efforts, so far, have failed.
>
> Also, PICK always complains that the index arg is of the wrong type, when
I
> try to combine the two procedures. I used a word & a number, but it didn't
> work with either.
>
> The following are some ideas I used, but getting a random string has never
> worked, so it has become messy:
>
>   balls: [ "String 1" "String 2" "String 3 " ... "String 50" ]
>   b-seed: RANDOM 50
>
>    pick-string FUNC [ "Picks a random string from balls." balls b-seed][
>        PICK balls (PROBE b-seed)
>   ; yes, more work is needed here
>    ]
>
> Tried to display each string with something like
>     BUTTON pick-string MAROON 50x50 FONT-SIZE 32
> but now the string does not display in the button.
>
> I was thinking that removing each string from balls, when picked, would
> ensure that there were no duplicates, but I haven't tried yet. CLEAR,
CHANGE
> & REMOVE are like using a chainsaw, therefore I presume REPLACE is needed
to
> delete just one element from a series/block. How can REPLACE be used to
not
> leave a blank string in the block, so that it can't be picked? This would
> also affect RANDOM's range the way I am using it.
>
> Any help/ideas will be appreciated.
>
> Donald Dalley
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

 
______________________________________________________________________________
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to