this is my problem
I've a variable number of items in an array
array (x, y, z, ..., n)
And i've a fixed total assigned to a variable
$min_int = 0;
$max_int = 8;
$total = 8;
I need to assign to every item in the array a random int from $min_int to $max_int and the total of the items in the array has to be always =8.
For example:
array (red, green, blue);
$min_int = 0;
$max_int = 8;
$total = 8;
the result could be
Array
(
[0] => 3
[1] => 5
[2] => 0
)
OR
Array
(
[0] => 3
[1] => 3
[2] => 2
)
I would develop in javascript.
Any suggestions please?
Here's the link of the table i've to populate with random int. Checking the client's checkboxes and the columns of days you want to populate, the loop has to generate the random int for the selected clients in the selected day and the total has to be =8 (col-# SUMMA), so for every days you select.