-
The following code rounds digit 5 up and returns a double; here: 13.
myDouble = Math.Round(12.5, MidpointRounding.AwayFromZero)
-
The following code rounds digit 5 to the nearest even number and returns a double; here: 12.
myDouble = Math.Round(12.5, MidpointRounding.ToEven)
-
The following code initializes a new Random object.
rand = new Random()
-
The following code generates a random integer between 1 and 10.]
myRandomInteger = rand.Next(1, 101)
-
The following code generates a random double between 1 and 50.
myRandomDouble = rand.NextDouble(1, 51)