In Excel I can just write:


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:


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:


But I don't know what to do in Mathematica


2 Answers 2


You can just rescale it

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

A plot:

 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}]]

histogram and PDF


Just to illustrate:

  • TransformedDistribution
  • Rescale

    td[a_, b_, min_, max_, n_] :=
    TransformedDistribution[(max -min) x + min,
    x \[Distributed] BetaDistribution[a, b]], n]
    rs[a_, b_, min_, max_, n_] := 
    Rescale[RandomVariate[BetaDistribution[a, b], n], {0, 1}, {min, max}]

enter image description here


Your Answer

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

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