Apportioning $100\%$ across $24$ hours

65 Views Asked by At

Assume I have value $x=500$. I would like to apportion this value $500$ across $24$ hours time period and would like it to be apportioned randomly. So if $500$ is $100\%$ the $x\%$ generated at random would be used to apportion the value of $X$ into $24$ segments. Any help?

1

There are 1 best solutions below

1
On

Make a list of $23$ random numbers between $0$ and $500$ inclusive. Append $0$ and $500$ to the list, and sort it. Each hour's allotment is the difference between two adjacent numbers in the sorted list. (This rule allows both $0$ and $500$; excluding $500$ is a bit trickier.)