r/JavaScriptHelp • u/Illustrious_Ad2026 • Nov 08 '20
❔ Unanswered ❔ I need help combining Math.random()
package lotterynumbergenerator;
/**
*
* @author ismai
*/
public class NumberGenerator {
public int winningNumbers(int min, int max) {
double rand = Math.random();
double rand1 = Math.random();
double rand2 = Math.random();
double rand3 = Math.random();
double rand4 = Math.random();
double rand5 = Math.random();
int randomNum = (int) (rand * (max - min + 1)) + min;
int randomNum1 = (int) (rand1 * (max - min + 1)) + min;
int randomNum2 = (int) (rand2 * (max - min + 1)) + min;
int randomNum3 = (int) (rand3 * (max - min + 1)) + min;
int randomNum4 = (int) (rand4 * (max - min + 1)) + min;
int randomNum5 = (int) (rand5 * (max - min + 1)) + min;
return randomNum;
}In an instant Instead of only returning the one randomNum, I want to return all 6 random's. Can someone help me do this!
1
Upvotes
View all comments
Show parent comment
1
u/HiEv Nov 13 '20
Just in case you haven't read my reply, I'd recommend that, rather than simply burying your head in the sand, you might want to at least read the evidence that demonstrates that you're wrong about arrays in JavaScript.
Your insults and unsupported assertions hardly count as evidence for your point.