lundi 18 septembre 2023

How do I create a random number generator, that each time it is called upon, returns a different value?

I've been trying to do this so I can create a maths problem game, with all random numbers so the game can continue for aslong as the user would like to. However I am currently using this:

Dim rand As New Random()
Dim approval As Integer = rand.Next(0, 9)

which every time it is called upon, returns the exact same digit.

I was hoping that this would return a different number each time, but after printing it a few times in the same run, I realised that it doesn't and returns the same number.




Aucun commentaire:

Enregistrer un commentaire