I have a value, say 20010. I want to randomly divide this value over 24 hours. So basically split the value into a 24 slot big array where all slots are randomly big.
Wh
This will give you a somewhat "decreasing" randomness the higher the index becomes. You can randomise the list positions if required? It depends on what you need to do with it.
int initialValue = 20010;
var values = new List();
Random rnd = new Random();
int currentRemainder = initialValue;
for (int i = 0; i < 21; i++)
{
//get a new value;
int val = rnd.Next(1, currentRemainder - (21 - i));
currentRemainder -= val;
values.Add(val);
}
values.Add(currentRemainder);
//initialValue == values.Sum()