mercredi 31 mars 2021

Loop random amount of times [duplicate]

I've been trying to create a simple program that will generate random numbers a random amount of times within specified range.

I've been able to create the random numbers in the specified range, however not sure how to set the amount of numbers generated to be random within a specified range.

The loop I'm using is

for (int i = 0; i < 10; i++)

which I understand will only make 10 random numbers be generated. Would really appreciate if anyone could show me or explain how I would use random to make the amount of numbers generated for example be between 5 and 20.

Thank you for your time and help in advance




Aucun commentaire:

Enregistrer un commentaire