August 31st, 2012, 09:09 AM
random partition in to k groups
How do you generate a random permutation of numbers from 0 to N without storing it in an array ?
Note that duplicates are to be avoided so I can't use rand() calls to generate them.
The problem I have is to partition N number of data points into k groups in random selection manner.
I thought of random shuffling of indices using random_shuffle of stl but the indices need to be stored in an array.
Is there a way to get N integers from [0..n] sorted in a random order, using which I can access a database ?
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.