mercredi 3 février 2021

Generate number 30% +- average number

I'm trying to create a random generator that takes a double value and outputs a new number that is either 30% over or under the input?

var result =  4 + random.NextDouble(); //output 4.2324355
var OverOrUnder = result + or - 20%

//Output to 1 decimal place
Console.WriteLine(OverOrUnder) 

Also how can I print the result so that it's only printing to 1 decimal place




Aucun commentaire:

Enregistrer un commentaire