I keep getting this error message with my program and I don't know how to fix it. Basically, I want the program to generate a set of random numbers using the specified ranges. However, I want 23 different numbers and instead of writing 23 lines of code for every individual random method, I want the two random methods I have to generate a different number every time it is called.
The two error messages are "System.Random is a type but is used like a variable".
Code:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace RandomWord { class WordProcess { static void Main(string[] args) { /* The program will close if the sequence "f*" is entered at the first 'Console.ReadLine'. */ string x; Console.WriteLine("Press any key to start:"); x = Console.ReadLine(); do { Random rng = Random((int)DateTime.Now.Ticks & 0x0000FFFF); Thread.Sleep(15); Random rng2 = Random((int)DateTime.Now.Ticks & 0x0000FFFF); Thread.Sleep(15); int con = rng.Next(0, 21); int vo = rng2.Next(0, 5); string[] conlist = { "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v" }; string[] volist = { "a", "e", "i", "o", "u" }; Thread.Sleep(10); Console.WriteLine(conlist[con] + volist[vo] + conlist[con] + volist[vo] + conlist[con] + volist[vo]); Console.ReadLine(); } while (x != "f*"); } } }




Reply With Quote