Random numbers with specific sum and varying maximum
4 次查看(过去 30 天)
显示 更早的评论
How can I generate random numbers with a specific sum and a specific minimum (zero) but varying maximum? I already tried randfixedsum function but the maximum is fixed not varying.
0 个评论
回答(1 个)
Jeff Miller
2021-4-13
How about first picking the maximum "thismax" randomly from whatever distribution you want, and then using randfixedsum to generate the remainder "desired_total-thismax" the remaining n-1 numbers?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!