Hoping someone can help me out. I am trying to create a basic little program that will generate a list of values from a pre-defined list of acceptable characters.
These characters will be - 'H', '/', 'L'.
The program should print these out in a random order with the majority of them being '/' with about 5% being 'L' and 5% being 'H'. (The percentages can vary). And the program should ask or have a variable that can determine how many characters it will print (i.e. 5 or 5000).
An example of the print out Im looking for:
/
/
/
/
/
L
/
/
/
/
/
H
H
/
/
/
/
Etc.
What would the best way be around this? Im really stumped and have no idea where to begin. Obviously I would create a list of the said characters. But how do I make the program favour one over the other based on percentages?
This is part of work that Im doing at my job where I have to generate a set of dummy data in various stages so this would save me hours of work if I can figure it out.
Any guidance or pointers would be appreciated.
Thank you
Aucun commentaire:
Enregistrer un commentaire