在Java中生成具有max,min和mean(平均值)的随机数 [英] Generate a random number with max, min and mean(average) in Java

查看:341
本文介绍了在Java中生成具有max,min和mean(平均值)的随机数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要生成具有以下属性的随机数。

I need to generate random numbers with following properties.

最小值应为200

最大值应为20000

Max should be 20000

平均值(均值)为500.

Average(mean) is 500.

可选:第75百分位为5000

Optional: 75th percentile to be 5000

绝对不是均匀分布,也不是高斯分布。我需要给出一些左偏斜。

Definitely it is not uniform distribution, nor gaussian. I need to give some left skewness.

推荐答案

Java Random可能无法正常工作,因为它只能为您提供正常(高斯)分布。

Java Random probably won't work because it only gives you normal(gaussian) distributions.

您可能正在寻找的是f分布(见下文)。您可以使用distlib库此处并选择 f distribution 。您可以使用随机获取随机数的方法。

What you're probably looking for is an f distribution (see below). You can probably use the distlib library here and choose the f distribution. You can use the random method to get your random number.

这篇关于在Java中生成具有max,min和mean(平均值)的随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆