Guest User

Untitled

a guest
Nov 21st, 2020
2,880
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3.  
  4. public class YOUR_PROJECT_NAME_HERE {
  5.  
  6.         public static void main(String args[]) {
  7.             int[] contents = {1,2,3,4,5,6,7,8,9};
  8.             Random random = new Random(YOUR_SEED_HEREL ^ 0x5deece66dL);
  9.  
  10. //change the number after the second i (right now 5) to however far you want to predict
  11.             for (int i = 0; i < 5; i++) {
  12.                 printNext(random, contents);
  13.             }
  14.         }
  15.  
  16.         public static void printNext(Random random, int[] contents) {
  17.             int i = -1;
  18.             int j = 1;
  19.  
  20.             for (int k = 0; k < contents.length; ++k) {
  21.                 if (random.nextInt(j++) == 0) {
  22.                     i = k;
  23.                 }
  24.             }
  25.  
  26.             System.out.println(contents[i]);
  27.         }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment