If I am understanding you..
you should only need to seed RANDOM once, 
anywhere before you use it, 

then yes you could could mess with your source array to 
avoid duplication ,and you could check for dups each time you 
added a string...

but you also might get lucky... 
and if not your target array is smaller so it's better to tweak that

rebol[]
        random/seed now
        ;...
        set-size: 6
        set: make block! set-size
        balls: copy []
        for i 1 50 1 [append/only balls rejoin["String " i]]

        loop set-size[append/only set pick balls random 50]
        set: unique set 
        while[(length? set) < set-size][
                append/only set pick balls random 50
                set: unique set 
        ]       



On Sat, 19 Jan 2002, Donald Dalley wrote:

> 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.
> 

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

Reply via email to