From 0e540dc3dae7c0b5462cade9ab15590117ef686d Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 18 Dec 2025 12:56:20 +0100 Subject: [PATCH] runtime: add calls to initRand() during run() for all schedulers. Intended to ensure that the random number seed used is always initialized on startup. Signed-off-by: deadprogram --- src/runtime/scheduler_cores.go | 1 + src/runtime/scheduler_threads.go | 1 + 2 files changed, 2 insertions(+) diff --git a/src/runtime/scheduler_cores.go b/src/runtime/scheduler_cores.go index c2736cafd..878472e45 100644 --- a/src/runtime/scheduler_cores.go +++ b/src/runtime/scheduler_cores.go @@ -136,6 +136,7 @@ func sleep(duration int64) { // other cores when ready. func run() { initHeap() + initRand() go func() { // Package initializers are currently run single-threaded. diff --git a/src/runtime/scheduler_threads.go b/src/runtime/scheduler_threads.go index 6d41d0c99..650a46534 100644 --- a/src/runtime/scheduler_threads.go +++ b/src/runtime/scheduler_threads.go @@ -22,6 +22,7 @@ var ( // can just initialize everything and run main.main on the main thread. func run() { initHeap() + initRand() task.Init(stackTop) initAll() callMain()