Random combination of letter generator

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
rppearso
Messages
199
Reaction score
3
Does anyone know where I can go to figure out how to generate a random 3-4 letter sequence BUT with every click that sequence is stored in an array and can not come up again?
 
Physics news on Phys.org
Do you have access to a programming language (Java, C, Pascal, etc...) with a prefined random function? Then, it should be no problem to translate a random number between 0 and 1 to a 3 or 4-letter sequence. Then, save all your sequences in a vector, and for every newly generated sequence, check if it is already in the vector, and generate a new one if it is so.
 
Erland said:
Do you have access to a programming language (Java, C, Pascal, etc...) with a prefined random function? Then, it should be no problem to translate a random number between 0 and 1 to a 3 or 4-letter sequence. Then, save all your sequences in a vector, and for every newly generated sequence, check if it is already in the vector, and generate a new one if it is so.

Hello Erland,

Thank you so much, I have access to MATLAB and visual basic. I have a moderate amount of experience with both but I am a little shakey on forming a vector and having the loop read from that vector. I know visual basic has a "randomize timer" function. Not sure about matlab. With Visual basic I can create buttons to display a new combination each time. So actually it would not even be a loop because I would want it initiated from a button click rather than automaticly. Of course another method might be to display all the possible combinations at one time and I could just scour through them.

It might be better to produce an exhuastive list of all possible letter combinations for 3 or 4 charachters.