# discrete_rv¶

Generates an array of draws from a discrete random variable with a specified vector of probabilities.

class quantecon.discrete_rv.DiscreteRV(q)[source]

Bases: object

Generates an array of draws from a discrete random variable with vector of probabilities given by q.

Parameters: q : array_like(float) Nonnegative numbers that sum to 1. q : see Parameters. Getter method for q. Q : array_like(float) The cumulative sum of q.

Methods

 draw([k, random_state]) Returns k draws from q.
draw(k=1, random_state=None)[source]

Returns k draws from q.

For each such draw, the value i is returned with probability q[i].

Parameters: k : scalar(int), optional Number of draws to be returned random_state : int or np.random.RandomState, optional Random seed (integer) or np.random.RandomState instance to set the initial state of the random number generator for reproducibility. If None, a randomly initialized RandomState is used. array_like(int) An array of k independent draws from q
q

Getter method for q.