Let $U_1,U_2,\ldots$ be a sequence of independent uniform $U(0,1)$ random variables, and let $$N = \min\{n\geq 2: U_n > U_{n-1}\}$$ In other words, $N$ is the index of the first uniform random variable that is larger than the one that comes immediately before. For example, if the numbers are $0.2$, $0.1$, $0.3$ then $N = 3$. Then $$\mathbb{P}\{N > n\} = \frac{1}{n!}$$

a.) What is the density function of $N$, i.e., what is $\mathbb{P}\{N = n\}$?

b.) Design a statistical test for randomness. Explain how to go from a specific random number generator, to the final recommendation on whether the generator is accepted or not.

I normally don't post a question without somewhat of an attempted solution, but I am pretty lost here. For part b.) I was thinking of using chi-squared to test for randomness or plotting the pairs of triplets in the sequence of $u_1,\ldots,u_n$ that are generated from $U(0,1)$ but I am not sure if this is sufficient or not. Any suggestions are greatly appreciated.


a) $\mathbb{P}\{N = n\} = \mathbb{P}\{N > n-1\}-\mathbb{P}\{N > n\}$.

For (b): It seems that you should design some test based on $N$. Say, Region of rejection of Null-hypothesis can be smth like $\{N>c\}$.

Say, for given $\alpha>0$ define $n$ such that $\dfrac{1}{n!}\leq \alpha<\dfrac{1}{(n-1)!}$. Then get samples from random numbers generator and find the index $N$ of the first random variable that is larger than the one that comes immediately before. If $N\leq n$, accept generator. Otherwise reject. Type-I error of this test is $P(N>n|H_0)=\dfrac{1}{n!}\leq\alpha$.

You can try to design some other tests based on this r.v. $N$.

  • $\begingroup$ Thank you, I was more so confused with b.) could you provide a more detailed answer? I can reward you with a 300 bounty once I can start a bounty $\endgroup$ – Wolfy Feb 23 '17 at 2:32
  • $\begingroup$ @Wolfy Try to make your own efforts. The question sounds like a problem from the homework that needs your solution trials. In particular, can you find the $\alpha$-level for the test with rejection region $\{N>c\}$? $\endgroup$ – NCh Feb 23 '17 at 3:05
  • $\begingroup$ It is not for homework, they are practice questions for preparing for the exam and I just don't really know where to begin with b.) if I had a solution that I could refer to then I would be able to solve questions like this $\endgroup$ – Wolfy Feb 23 '17 at 3:07
  • $\begingroup$ Try firstly to design test with Rejection region as above. $\endgroup$ – NCh Feb 23 '17 at 3:09
  • $\begingroup$ umm, you mean like region where $N > c$ such that $c$ is something that contradicts the way $N$ is defined, if that makes any sense $\endgroup$ – Wolfy Feb 23 '17 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.