1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 // This test is first, in its own file with an alphabetically early name,
13 // to try to make sure that it runs early. It has the best chance of
14 // detecting deterministic seeding if it's the first test that runs.
16 func TestAuto(t *testing.T) {
17 // Pull out 10 int64s from the global source
18 // and then check that they don't appear in that
19 // order in the deterministic seeded result.
21 for i := 0; i < 10; i++ {
22 out = append(out, Int64())
25 // Look for out in seeded output.
26 // Strictly speaking, we should look for them in order,
27 // but this is good enough and not significantly more
28 // likely to have a false positive.
29 r := New(NewPCG(1, 0))
31 for i := 0; i < 1000; i++ {
35 if found == len(out) {
36 t.Fatalf("found unseeded output in Seed(1) output")