From 53522ec4331ebc18d3aa0e6e935c9c1f79ef4a90 Mon Sep 17 00:00:00 2001 From: changgesi Date: Thu, 11 Dec 2025 11:56:14 +0800 Subject: [PATCH] refactor: use b.Loop() to simplify the code and improve performance Signed-off-by: changgesi --- pkg/random/random_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/random/random_test.go b/pkg/random/random_test.go index 8b2f69318b..146a193678 100644 --- a/pkg/random/random_test.go +++ b/pkg/random/random_test.go @@ -36,19 +36,19 @@ func TestPseudoRandom(t *testing.T) { } func BenchmarkBytes(b *testing.B) { - for i := 0; i < b.N; i++ { + for b.Loop() { Bytes(100) } } func BenchmarkIntn(b *testing.B) { - for i := 0; i < b.N; i++ { + for b.Loop() { Int63n(100) } } func BenchmarkString(b *testing.B) { - for i := 0; i < b.N; i++ { + for b.Loop() { String(100) } }