Re: random limited repetition from array...
- From: "Larry Lard" <larrylard@xxxxxxxxxxx>
- Date: 27 Jun 2006 02:30:31 -0700
mj.clift@xxxxxxxxxx wrote:
Hi All,
I need to be able to choose a random string from an array. That is easy
enough, but I want to restrict the repetition of that string until one
or two other choices have been made. So the following output would be
ok a,b,c,a,d,c or a,c,d,a,d,a but the following would not; a,b,c,c, or
a,b,b,c, etc... I hope that makes sense.
Almost, but there is some information missing. From what you wrote I
understand that you want to:
Have as input a set of characters
Prepare a string for output, initially empty
Repeatedly choose a random element from this set, and append it to a
string for output
- with the limitation that an element should not be immediately
repeated
At some point - stop, and return the string
The outstanding question is: when do we stop? Taking your example of
abcadc as valid output - would abcad be valid? abca? abc? Tell us the
rule for when to stop and we can proceed.
If it helps to understand what I'm trying to do I have the following
python code.
Python is still on my -to do- list, unfortunately :)
--
Larry Lard
Replies to group please
.
- Follow-Ups:
- Re: random limited repetition from array...
- From: mj . clift
- Re: random limited repetition from array...
- References:
- random limited repetition from array...
- From: mj . clift
- random limited repetition from array...
- Prev by Date: Re: How to safely break the thread
- Next by Date: RE: Callbacks from .NET 1.1 process to .NET 2.0
- Previous by thread: random limited repetition from array...
- Next by thread: Re: random limited repetition from array...
- Index(es):
Relevant Pages
|