We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# PRNG Sequence Guessing

# PRNG Sequence Guessing

delamath + 0 comments For those who are not using Java to solve this problem, the following is some related source code from the java.util.Random library. ;)

public synchronized void setSeed(long seed) { this.seed = (seed ^ 0x5DEECE66DL) & ((1L << 48) - 1); haveNextNextGaussian = false; } protected synchronized int next(int bits) { seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1); return (int) (seed >>> (48 - bits)); } public int nextInt(int n) { if (n <= 0) throw new IllegalArgumentException("n must be positive"); if ((n & -n) == n) // i.e., n is a power of 2 return (int) ((n * (long) next(31)) >> 31); int bits, val; do { bits = next(31); val = bits % n; } while (bits - val + (n - 1) < 0); return val; }

thexguy + 0 comments Test case #4 clearly violates the definition of the problem. In the description it says "The first line of input is a number N<10..." while Test case #4 provides exactly 10 test cases.

zouhair_madid + 0 comments Hello, Is it even possible to solve this challenge in C++?

sherifmowafy + 0 comments Couldn't help but notice that all the submitted codes for this problem do not match the current problem statement input, they had extra "start time" and "end time" inputs which makes the problem much easier. Has anybody solved this problem lately without these inputs?

Chandika + 0 comments Is it even possible to solve this challenge in Python?

Load more conversations

Sort 48 Discussions, By:

Please Login in order to post a comment