For some kid game, I have an array of size 10 of bool type. I got a random number between 1 to 10 and what I like to do, Is initialize only that number of cells in TRUE but in random order.
For example, If my random number is 4, I would like outputs like:
F T F F F T T F F T
T F F T T T F F F F
Is there an easy way to do it in C#?
Note, I know all the syntax (Init an array, work with random and all), I have a problem to find a short algorithm that does it.
Thanks in advanced.
Aucun commentaire:
Enregistrer un commentaire