Skip to content

Instantly share code, notes, and snippets.

@RashidJorvee
Created January 5, 2019 17:02
Show Gist options
  • Save RashidJorvee/5a9893017b70e52919070ebbff962e90 to your computer and use it in GitHub Desktop.
Save RashidJorvee/5a9893017b70e52919070ebbff962e90 to your computer and use it in GitHub Desktop.
How to generate and get a random number in Java?
package rashid.jorvee;
import java.lang.Math;
import java.util.ArrayList;
import java.util.Collections;
public class GenerateRandomNumber {
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<Integer>();
for (int i=0; i<245; i++) {
list.add(i);
}
Collections.shuffle(list);
for (int i=0; i<245; i++) {
System.out.println("Value::"+list.get(i));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment