Getting N random numbers that the sum is M

Posted by marionmaiden on Stack Overflow See other posts from Stack Overflow or by marionmaiden
Published on 2010-04-14T18:37:38Z Indexed on 2010/04/14 18:43 UTC
Read the original article Hit count: 214

Filed under:
|
|
|

Hello

I want to get N random numbers that the sum of them is a value.

For example, let's suppose I want 5 random numbers that their sum is 1

Then, a valid possibility is:

0.2 0.2 0.2 0.2 0.2

Other possibility is:

0.8 0.1 0.03 0.03 0.04

And so on. I need this for the creation of the matrix of belongings of the Fuzzy C-means.

© Stack Overflow or respective owner

Related posts about java

Related posts about random