From 8f4a4acbcaf4dc1be8c36bce23f40e2a8bcf346c Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 2 Jun 2018 14:09:30 +0200 Subject: [PATCH] Made randomSeed a const for tests --- kmeans_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kmeans_test.go b/kmeans_test.go index 4b2ea16..0824098 100644 --- a/kmeans_test.go +++ b/kmeans_test.go @@ -7,7 +7,9 @@ import ( "github.com/muesli/clusters" ) -var RANDOM_SEED = int64(42) +const ( + randomSeed = int64(42) +) func TestNewErrors(t *testing.T) { _, err := NewWithOptions(0.00, nil) @@ -71,7 +73,7 @@ func TestDimensions(t *testing.T) { } func benchmarkPartition(size, partitions int, b *testing.B) { - rand.Seed(RANDOM_SEED) + rand.Seed(randomSeed) var d clusters.Observations for i := 0; i < size; i++ { @@ -85,7 +87,6 @@ func benchmarkPartition(size, partitions int, b *testing.B) { km := New() km.Partition(d, partitions) } - } func BenchmarkPartition32Points(b *testing.B) { benchmarkPartition(32, 16, b) }