Arcee Palabrica8,099 Points
Code variations which one is more advisable to use...
I was just curious and tried using different code variations to generate 3 random numbers. How is it different from the one used in this video and which one is advisable to use?
Generating Random Numbers:
int randomNumber = (int) (Math.random() * 3); // versus int randomNumber = randomGenerator.nextInt(3);
Assign randomNumber to fact:
fact = Integer.toString(randomNumber); //versus fact = randomNumber + "";
I still got the same result when I ran the app.
Ben DeitchTreehouse Teacher
Hey Arcee! There's not always a clear best way to do something. Each of those code variations should work just fine; feel free to pick your favorite :)