Skip to content

Commit 044ec3c

Browse files
committed
adjust "not identity at least once" test
1 parent 6954628 commit 044ec3c

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
@@ -1071,14 +1071,12 @@ end
10711071
end
10721072
end
10731073
@testset "not identity" begin
1074-
function is_not_identity_at_least_once()
1075-
function f(::Any)
1076-
tup = ntuple(identity, 9)
1077-
tup !== shuffle(tup)
1078-
end
1079-
@test any(f, 1:1000000)
1074+
function shuffle_is_identity()
1075+
tup = ntuple(identity, 9)
1076+
tup === shuffle(tup)
10801077
end
1081-
is_not_identity_at_least_once()
1078+
# 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
1079+
@test any((_ -> !shuffle_is_identity()), 1:1000000)
10821080
end
10831081
end
10841082

0 commit comments

Comments
 (0)