In [2]:
import numpy as np
In [3]:
np.__version__
Out[3]:
In [5]:
__author__ = 'kyubyong. longinglove@nate.com'
Q1. Create an array of shape (3, 2) and populate it with random samples from a uniform distribution over [0, 1).
In [49]:
Out[49]:
Q2. Create an array of shape (1000, 1000) and populate it with random samples from a standard normal distribution. And verify that the mean and standard deviation is close enough to 0 and 1 repectively.
In [42]:
Q3. Create an array of shape (3, 2) and populate it with random integers ranging from 0 to 3 (inclusive) from a discrete uniform distribution.
In [44]:
Out[44]:
Q4. Extract 1 elements from x randomly such that each of them would be associated with probabilities .3, .5, .2. Then print the result 10 times.
In [3]:
x = [b'3 out of 10', b'5 out of 10', b'2 out of 10']
Q5. Extract 3 different integers from 0 to 9 randomly with the same probabilities.
In [66]:
Out[66]:
Q6. Shuffle numbers between 0 and 9 (inclusive).
In [86]:
In [88]:
# Or
Q7. Assign number 10 to the seed of the random generator so that you can get the same value next time.
In [91]: