# What is rand(distrSamp, n) for distrSamp being a probability distribution sampler?

In the Distribution package, suppose `distrSamp` is of type probability distribution sampler. What exactly does the function`rand(distrSamp,n)` do ? What’s the returned value of this function? Or is it because of method dispatching, different probability distribution sampler would make this function return different values?

`Edit:` I think I figure it out. I think it’s because of both “method dispatching” and the property of each probability distribution sampler. For example,

If `distrSamp` is `Categorical([0.5, 0.2, 0.3])`, then `rand(distrSamp,100)` would return a vector of length 100, with each element of this vector being picked from 1 (with probability 0.5), 2 (with probability 0.2) and 3 (with probability 0.3).

On the other hand, if `distrSamp` is `Exponential(0.02)`, then `rand(distrSamp,100)` would return a vector of length 100, with all of them together form a part / sample of an exponential distribution with rate 0.02. Or do you have a better explanation for Exponential distribution this case?