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(); }

Want to kickstart your project?Use the new AI Studio to create your code