Mega Code Archive

 
Categories / C# / Development Class
 

Generate and display 5 random floating point values from 0 to 1

using System; using System.Threading; public class MainClass {     public static void Main(){              Random rand = new Random();                  byte[] bytes = new byte[4];                Console.WriteLine("Five Doubles.");         for (int ctr = 0; ctr <= 4; ctr++)            Console.Write("{0,8:N3}", rand.NextDouble());     } }