Skip to content

Commit bed23af

Browse files
committed
adjust "not identity at least once" test
1 parent 35feb2d commit bed23af

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

stdlib/Random/test/runtests.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,14 +1079,12 @@ end
10791079
end
10801080
end
10811081
@testset "not identity" begin
1082-
function is_not_identity_at_least_once()
1083-
function f(::Any)
1084-
tup = ntuple(identity, 9)
1085-
tup !== shuffle(tup)
1086-
end
1087-
@test any(f, 1:1000000)
1082+
function shuffle_is_identity()
1083+
tup = ntuple(identity, 9)
1084+
tup === shuffle(tup)
10881085
end
1089-
is_not_identity_at_least_once()
1086+
# shuffling may behave as the identity sometimes, but if it doesn't manage to actually reorder some of the elements at least once, something is wrong
1087+
@test any((_ -> !shuffle_is_identity()), 1:1000000)
10901088
end
10911089
end
10921090

0 commit comments

Comments
 (0)