Skip to content
Advertisement

Non repeating character from a preset of characters

I would like to pick a random letter out of a list B, C, D at random order and would make sure that they do not repeat. I have tried this but it repeats the letters

JavaScript

Advertisement

Answer

You should check, if character already taken, for example declare another one array which contains already taken character, so if character caontains in this array, try to select another character, OR you can simply use Collections.shuffle method(Collection knowledge required)

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement