# How to generate random numbers for Beta distribution in a range?

In Excel I can just write:

BETA.INV(RAND(),alpha,beta,lowerbound,upperbound)


To generate a beta distributed random between lower bound and upper bound

How can I do the same in Mathematica?

In other words hat is the right way to scale the output of:

RandomVariate[BetaDistribution[3,3]]


So that instead of generating a number between 0 and 1 it gives me a number between 25 and 73?

In Excel I would just write:

BETA.INV(RAND(),3,3,25,73)


But I don't know what to do in Mathematica

You can just rescale it

RandomVariate[BetaDistribution[3,3]] * (max - min) + min


A plot:

Show[
Histogram[Array[RandomVariate[BetaDistribution[3, 3]]*48 + 25 &, 100000], 48,"PDF"],
Plot[{((1-((x-25)/48))^(-1+3)((x-25)/48)^(-1+3))/(48 Beta[3,3])}, {x, 25,73}]]


Just to illustrate:

• TransformedDistribution
• Rescale

td[a_, b_, min_, max_, n_] :=
RandomVariate[
TransformedDistribution[(max -min) x + min,