Generation

generate functionWed, 07 Dec 2022

create a hundred threads that searches an array of 10000 random numbers

public void ThreadWorker() { int max = 10000; int[] arr = new int[max]; Random r = new Random(); for (int i = 0; i < max; i++) { arr[i] = r.Next(); } foreach (int i in arr) { Console.WriteLine(i); } } for (int i = 0; i < 100; i++) { Thread t = new Thread(ThreadWorker); t.Start(); }

Questions about programming?Chat with your personal AI assistant