Consider $50$ random variables with probability distribution:

$X∼Bin(20,.1)$, where $n=20$ and $p=.1$.

Now take a random sample of size $i; \ i=1,5,12,30,40$ from the 50 random variables and plot the histogram of such sample. Compare each of the 5 histograms.

What I've done so far :

data = RandomVariate[BinomialDistribution[20, 0.1], 20^4];

Show[Histogram[data, {1}, "PDF"], 
DiscretePlot[PDF[BinomialDistribution[20, 0.1], x], {x, 0, 20}, 
PlotStyle -> PointSize[Medium]]]

which gives a single histogram for different values of r.v. X

My question is how to generate 50 of them and then how to take a random sample of size $i$ from them ?

  • 1
    $\begingroup$ When you post something simultaneously on two forums you should show the link to the other forum. If you haven't mentioned that, then If someone answers or provides an informative comment on one forum, then you're wasting others' time on the other forum. stats.stackexchange.com/questions/346673/… $\endgroup$
    – JimB
    May 17, 2018 at 3:04

1 Answer 1


Check out RandomSample and RandomChoice


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.