You didn’t ask about it, but in case other readers are wondering about it, this is because the precision of floating-point numbers depends on the exponent of the number being represented (this is what makes it “floating” instead of “fixed”), and for 1.0, the maximum precision is smaller than min_float, so that adding or substracting min_float does not have any effect. More generally, this phenomenon is quantified by the “unit in the last place” (ULP): Unit in the last place - Wikipedia.

Note that this solution (rejection sampling) is just fine, given that you will never get 1.0 in practice if you call Random.float 1.0. (With the current implementation I believe that the probability for this to happen is 2^{-53}, modulo floating-point approximations).