3 ms·
> This actually cannot happen with random assignment either. The only way you're going to get equal numbers in each bin is if your process is intentionally cons
by redis_mlc 6y ago
> This actually cannot happen with random assignment either. The only way you're going to get equal numbers in each bin is if your process is intentionally constrained to do that.
There are several CS shuffle/Fisher-Yates algorithms that can do this. Instead of calling the usual rand() on a mathematical interval multiple times, they do selection over the remaining elements (ie. constrained.)
https://dev.to/babak/an-algorithm-for-picking-random-numbers-in-a-range-without-repetition-4cp6 https://dev.to/babak/an-algorithm-for-picking-random-numbers...
But I would expect CS people to have awareness about that, not social scientists, unless somebody wrote a paper with examples for that field.
I've seen Fisher-Yates used in an SRE interview before, which is pedantic - it's just whiteboard hazing, at a very high cost to your recruiting and interviewing staff.