From f97f0eff8d9f818df878bbf8cf3ae4914d8763e5 Mon Sep 17 00:00:00 2001 From: Acho Arnold Date: Tue, 10 Oct 2023 21:56:35 +0300 Subject: [PATCH] fix random number generator --- api/pkg/services/message_thread_service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/pkg/services/message_thread_service.go b/api/pkg/services/message_thread_service.go index 45f83c65..2556e09e 100644 --- a/api/pkg/services/message_thread_service.go +++ b/api/pkg/services/message_thread_service.go @@ -167,8 +167,8 @@ func (service *MessageThreadService) getColor() string { "deep-orange", "brown", } - rand.Seed(time.Now().UnixNano()) - return colors[rand.Intn(len(colors))] + generator := rand.New(rand.NewSource(time.Now().UnixNano())) + return colors[generator.Intn(len(colors))] } // MessageThreadGetParams parameters fetching threads