I'd like to generate random numbers in a range (say between 0 and 1) - but with a certain step size (say 0.05). There's a python function that does exactly that:
random.randrange ( [start,] stop [,step] )
So my problem is not how to generate random numbers in a range - instead I need a way to do this with a certain step size. How can this be done in .NET?
You could generate a random integer between 0 and 20 and divide the result by 20
Dim rnd = New Random()
Dim nextValue = rnd.Next(21) / 20
This will give you a random number between 0 and 1 (inclusive) in 0.05 increments
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With