Is the probability density for c = np.random.random() and d = 30 * np.random.random() same?

42 Views Asked by At

import numpy as np

c = np.random.random()

Then we know c is uniformly distributed over the half-open interval [0,1) and the probability density function (pdf) of c is given by, $$ p(c) = \begin{cases} \frac{1}{1-0}~\text{ for}~ 0 \leq c < 1\\ 0,~\text{otherwise} \end{cases} $$ Now, if we generate d as follows:

scalar = 30

d = scalar * np.random.random()

then what is the pdf of d i.e. p(d)?

1

There are 1 best solutions below

0
On BEST ANSWER

d also has a uniform distribution, but now it's on the range $[0,30)$. So $$ p(d) = \begin{cases} \frac{1}{30-0}~\text{ for}~ 0 \leq d < 30\\ 0,~\text{otherwise} \end{cases} $$