Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class YOUR_PROJECT_NAME_HERE {
- public static void main(String args[]) {
- int[] contents = {1,2,3,4,5,6,7,8,9};
- Random random = new Random(YOUR_SEED_HEREL ^ 0x5deece66dL);
- //change the number after the second i (right now 5) to however far you want to predict
- for (int i = 0; i < 5; i++) {
- printNext(random, contents);
- }
- }
- public static void printNext(Random random, int[] contents) {
- int i = -1;
- int j = 1;
- for (int k = 0; k < contents.length; ++k) {
- if (random.nextInt(j++) == 0) {
- i = k;
- }
- }
- System.out.println(contents[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment