random limited repetition from array...



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.

If it helps to understand what I'm trying to do I have the following
python code.

for x in NumberChoices :
while FirstChoice in state[0:2]: #or for x in range(2):
FirstChoice = choice(NextChoice[Choice_List[-1]])
Sequence_List.append(FirstChoice)
state[x%2] = FirstChoice

I've just started with c# so any help would be of great help.

Thank you,

Calvin

.



Relevant Pages

  • Re: sending array with POST from a hidden input form field?
    ... be safe (like if you are transferring secret US government data:P), ... Generate a random string. ... Serialize the array you are transferring and store it in a file with ... This method is relatively safe as well as it will be difficult to guess ...
    (comp.lang.php)
  • Re: Newbie question on encryption keys
    ... but it's still safer to use a completely random string ... You have to assume that every attacker already has some information ... repetition patterns in all or many of your passwords, ... "You can't trust code that you did not totally create yourself" ...
    (comp.security.misc)
  • Re: Newbie question on encryption keys
    ... but it's still safer to use a completely random string ... You have to assume that every attacker already has some information ... repetition patterns in all or many of your passwords, ... which makes things in your life stay as ...
    (comp.security.misc)
  • Re: Newbie question on encryption keys
    ... but it's still safer to use a completely random string without ... repetition. ... Security is the one concept, which makes things in your life stay as ...
    (comp.security.misc)
  • Re: strtoint
    ... >trouble me. ... Why not make an array of the set of characters you want ... >to be in the random string and then randomly select from the set of ...
    (comp.lang.c)