how to fill a matrix, with random numbers between 1 and the other parameter chosen by the user: exp: between 1 and 30 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to fill a matrix, with random numbers between 1 and the other parameter chosen by the user: exp: between 1 and 30

18th Dec 2017, 4:53 PM
Anthony
1 Answer
0
(int)(Math.random()*userInput)+1; this will give a random integer between 1 and whatever the user entered.
18th Dec 2017, 5:09 PM
Jeremy
Jeremy - avatar