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,
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
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?