lundi 6 décembre 2021

How can I generate a random number sequence of a specific length? c#

I am trying to implement the Digit Span task, where the participant has to reproduce sequences of numbers. It starts with three numbers and if the participant is answering correctly one number is added. If the participant is wrong he will hear another sequence with the same length again and if he is then again wrong the sequence is reduced by one number.

So far I am solving this with Lists (threeDigits, FourDigits, FiveDigits,..) that are filled at the beginning with some Audio Files of that certain length. But this is quite complicated because I need to add so many Audio Files.

Instead of filling the lists with specific Audio Files I want to solve this now by randomly generating a sequence depending on the List that was chosen. So for example if the List "four Digits" was chosen a random sequence of four numbers should be generated. I have recorded audio files for each number (1-9) and for the four Digits List randomly four of them should be played.

I am really new to Unity so I don't really know how to do this. If you could help me or have any advice I would be very thankful.




Aucun commentaire:

Enregistrer un commentaire