dimanche 9 décembre 2018

How to random a decimal number from maximum in JavaScript

I already find a solution on this community but I can't find a solution. My question is "How to random a decimal number from maximum in JavaScript?"

Example: If I set Total to 1 and Size to 5, Then I want to generate a decimal number to an array(Size 5) that Sum total at 1.

Sum Total: 1
Array Size: 5

Result Array:

[0.23, 0.12, 0.4, 0.14, 0.11]

Thank you for all advice. Best regards.




Aucun commentaire:

Enregistrer un commentaire