I need a array in which the numbers form 1-25 are randomly arranged everytime (no repetition) . Can anyone Debug my code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need a array in which the numbers form 1-25 are randomly arranged everytime (no repetition) . Can anyone Debug my code

https://code.sololearn.com/W9VPL2I89T5N/?ref=app

4th Apr 2020, 1:10 PM
Muhammed Ajmal M
Muhammed Ajmal M - avatar
2 Answers
+ 1
the problem with your code is that the for loop goes from 0 to 24, but in 25 iterations it very difficult to pick 25 different numbers! I think, you can first, fill the array with the 25 numbers, and then shuffle it. look here for how to shuffle an array : https://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array/6274381#6274381
4th Apr 2020, 1:46 PM
John Robotane
John Robotane - avatar
0
Ok
4th Apr 2020, 2:14 PM
Muhammed Ajmal M
Muhammed Ajmal M - avatar