If you actually care about the 3 case, this should be decently fast:
function sample3(n)
i1 = rand(1:n)
i2 = rand(1:(n - 1))
i3 = rand(1:(n - 2))
i2 += i2 >= i1
i3 += i3 >= min(i1, i2)
i3 += i3 >= max(i1, i2)
return i1, i2, i3
end