Source file src/internal/syscall/unix/getrandom_linux_test.go

     1  // Copyright 2024 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.
     4  
     5  package unix_test
     6  
     7  import (
     8  	"internal/syscall/unix"
     9  	"testing"
    10  )
    11  
    12  func BenchmarkParallelGetRandom(b *testing.B) {
    13  	b.SetBytes(4)
    14  	b.RunParallel(func(pb *testing.PB) {
    15  		var buf [4]byte
    16  		for pb.Next() {
    17  			if _, err := unix.GetRandom(buf[:], 0); err != nil {
    18  				b.Fatal(err)
    19  			}
    20  		}
    21  	})
    22  }
    23  

View as plain text