lundi 17 août 2015

How to do smooth Random in C# with step?

How to generate random value from 5 to 10 with step 0.4?

I tried:

var numberOfSteps = 0.4;
            var _step = (maximum - minimum) / numberOfSteps;
            var difference = maximum - minimum;
            var stepsToDifference = Math.Round(difference / _step);
            return Convert.ToString(minimum + _step * stepsToDifference);




Aucun commentaire:

Enregistrer un commentaire