mercredi 27 janvier 2021

java, Generate n random non-zero numbers that add up to a specific sum with each random number is a multiple of 0.5

I'm having trouble trying to generate n non-zero numbers adding up to a specific sum with each random number is a multiple of 0.5 . For example, generate 3 numbers that add up to 6, the output can be : 1.5, 2.5, 2.

Could someone help me with it please. Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire