This is a follow-up question to the Why shuffling by picking random position in all array instead of a part is not correct. I understand if I pick random numbers from all the range for 4 numbers every time the distribution won't be uniform. That's why improved Fisher–Yates shuffle algorithm picks numbers from the smaller range:
-- To shuffle an array a of n elements (indices 0..n-1):
for i from 0 to n−2 do
j ← random integer such that i ≤ j < n
exchange a[i] and a[j]
For 4 numbers it produces the the following ranges:
[0]
[0, 1]
[0, 1, 2]
[0, 1, 2, 3]
My question is whether it's important that the range starts from the 0
and increments sequentially? Are the following ranges generate uniform distribution as well?
[2] --- start from the middle
[1, 2] --- add one number to the left
[1, 2, 3] --- add one number to the right
[0, 1, 2, 3]
Thanks