libgo: update to Go 1.11
[official-gcc.git] / libgo / go / runtime / rand_test.go
blob1b84c79d24fb0aa8fd64de7d292a68a98c60ecd4
1 // Copyright 2017 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.
5 package runtime_test
7 import (
8 . "runtime"
9 "strconv"
10 "testing"
13 func BenchmarkFastrand(b *testing.B) {
14 b.RunParallel(func(pb *testing.PB) {
15 for pb.Next() {
16 Fastrand()
21 func BenchmarkFastrandHashiter(b *testing.B) {
22 var m = make(map[int]int, 10)
23 for i := 0; i < 10; i++ {
24 m[i] = i
26 b.RunParallel(func(pb *testing.PB) {
27 for pb.Next() {
28 for range m {
29 break
35 var sink32 uint32
37 func BenchmarkFastrandn(b *testing.B) {
38 for n := uint32(2); n <= 5; n++ {
39 b.Run(strconv.Itoa(int(n)), func(b *testing.B) {
40 for i := 0; i < b.N; i++ {
41 sink32 = Fastrandn(n)