...

Source file src/go.mongodb.org/mongo-driver/internal/randutil/randutil_test.go

Documentation: go.mongodb.org/mongo-driver/internal/randutil

     1  // Copyright (C) MongoDB, Inc. 2022-present.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License"); you may
     4  // not use this file except in compliance with the License. You may obtain
     5  // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
     6  
     7  package randutil
     8  
     9  import (
    10  	"testing"
    11  
    12  	"go.mongodb.org/mongo-driver/internal/require"
    13  )
    14  
    15  func TestCryptoSeed(t *testing.T) {
    16  	seeds := make(map[uint64]bool)
    17  	for i := 1; i < 1000000; i++ {
    18  		s := cryptoSeed()
    19  		require.False(t, seeds[s], "cryptoSeed returned a duplicate value %d", s)
    20  		seeds[s] = true
    21  	}
    22  }
    23  

View as plain text