Home  >  Q&A  >  body text

How to generate a sequence based on minimum value, maximum value and standard deviation

To do experiments, you need to generate a sequence based on the minimum value, maximum value and standard deviation. The programming language is not limited. Please provide an idea. The size of the sequence is about 1000

高洛峰高洛峰2736 days ago647

reply all(1)I'll reply

  • 阿神

    阿神2017-05-16 13:31:42

    The questioner did not explain the specific requirements for a random number sequence, such as whether it is an integer or a real number, what statistical distribution needs to be met, etc. It is assumed here that the subject needs to generate real numbers and the distribution is centrally symmetric. This distribution might as well be constructed using the Beta distribution, since it allows for adjustment of the standard deviation. If the random variable is taken as

    $$min+(max - min) X,quad X sim Beta{(alpha, alpha)}$$

    It is easy to calculate the standard deviation at this time as

    $$s = frac{max - min}{2sqrt{1+2alpha}}$$

    That’s

    $$alpha = frac{(max-min)^2}{8s^2}-frac{1}{2}$$

    Through the above analysis, it is easy to write code with Mathematica:

    Test the effect. Take the minimum value 20, the maximum value 100, and the standard deviation 15:

    reply
    0
  • Cancelreply