I need to generate 1000 samples (int) with average 2.
Do you think such a function already exists in python?
>Solution :
NumPy’s random.randint(low, high=None, size=None, dtype=int) generates "random integers from the “discrete uniform” distribution of the specified dtype in the “half-open” interval [low, high)".
Therefore, to generate random integers with mean of 2 just make sure that the interval you specify is centred on 2.
>>> import numpy as np
>>> np.random.randint(0,5,10000000).mean()
1.999827
>>> np.random.randint(-10,15,10000000).mean()
2.000426