Sum
1 The
of ooh
and 0.44 is cacal
to.
Answers
Answered by
0
Answer:
25
4
I have a long list of say 1 million Uniform(0,1) random numbers, such as:
dat = {0.71, 0.685, 0.16, 0.82, 0.73, 0.44, 0.89, 0.02, 0.47, 0.65}
I want to partition this list whenever the cumulative sum exceeds 1. For the above data, the desired output would be:
{{0.71, 0.685}, {0.16, 0.82, 0.73}, {0.44, 0.89}, {0.02, 0.47, 0.65}}
I was trying to find a neat way to do this efficiently with Split combined with say Accumulate or FoldList or Total, but my attempts with Split have not been fruitful. Any suggestions?
Similar questions