jeudi 28 janvier 2016

generate random integers with fixed sum and constraints

How to generate 6 random integers which add up to 8, and each one is less than 2?

eg. 1,2,1,2,2,0

For far I have found the method which give the random integers with fixed sum but how to impose the constraints on these integers.




Aucun commentaire:

Enregistrer un commentaire