I am writing a very simple program, yet I cant seem to get it to work properly. I want to start with an array with numbers from 1-69 and then randomly select 5 numbers from this array without repeating. And i dont want to just shuffle the array and take the first 5 numbers. I want it to resemble more of a darwing numbers out of a hat with the probability being the way it should be. For Example:
Array1[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
Array2[]
// I want it to randomly choose an element from Array1, remove it from Array1, and place it in Array2. Then repeat the process until I have 5 randomly pulled numbers from Array1 without repeating.
Any help is greatly appreciated! Thank You!
P.s. I am writing this project in C.
Aucun commentaire:
Enregistrer un commentaire