diff --git a/src/system/kernel/scheduler/scheduler_affine.cpp b/src/system/kernel/scheduler/scheduler_affine.cpp index 10fa82ce5a..c2a5c0c31d 100644 --- a/src/system/kernel/scheduler/scheduler_affine.cpp +++ b/src/system/kernel/scheduler/scheduler_affine.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "scheduler_common.h" #include "scheduler_tracing.h" @@ -89,19 +90,6 @@ struct scheduler_thread_data { }; -static int -_rand(void) -{ - static int next = 0; - - if (next == 0) - next = system_time(); - - next = next * 1103515245 + 12345; - return (next >> 16) & 0x7FFF; -} - - static int dump_run_queue(int argc, char **argv) { @@ -422,7 +410,7 @@ affine_reschedule(void) // skip normal threads sometimes // (twice as probable per priority level) - if ((_rand() >> (15 - priorityDiff)) != 0) + if ((fast_random_value() >> (15 - priorityDiff)) != 0) break; nextThread = lowerNextThread; diff --git a/src/system/kernel/scheduler/scheduler_simple.cpp b/src/system/kernel/scheduler/scheduler_simple.cpp index a68a1c3a47..6b60d3ca0c 100644 --- a/src/system/kernel/scheduler/scheduler_simple.cpp +++ b/src/system/kernel/scheduler/scheduler_simple.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "scheduler_common.h" #include "scheduler_tracing.h" @@ -43,19 +44,6 @@ const bigtime_t kThreadQuantum = 3000; static Thread *sRunQueue = NULL; -static int -_rand(void) -{ - static int next = 0; - - if (next == 0) - next = system_time(); - - next = next * 1103515245 + 12345; - return (next >> 16) & 0x7FFF; -} - - static int dump_run_queue(int argc, char **argv) { @@ -272,7 +260,7 @@ simple_reschedule(void) // skip normal threads sometimes // (twice as probable per priority level) - if ((_rand() >> (15 - priorityDiff)) != 0) + if ((fast_random_value() >> (15 - priorityDiff)) != 0) break; nextThread = lowerNextThread; diff --git a/src/system/kernel/scheduler/scheduler_simple_smp.cpp b/src/system/kernel/scheduler/scheduler_simple_smp.cpp index 7ca4d7f598..c4d1e8a2df 100644 --- a/src/system/kernel/scheduler/scheduler_simple_smp.cpp +++ b/src/system/kernel/scheduler/scheduler_simple_smp.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "scheduler_common.h" #include "scheduler_tracing.h" @@ -46,19 +47,6 @@ static int32 sCPUCount = 1; static int32 sNextCPUForSelection = 0; -static int -_rand(void) -{ - static int next = 0; - - if (next == 0) - next = system_time(); - - next = next * 1103515245 + 12345; - return (next >> 16) & 0x7FFF; -} - - static int dump_run_queue(int argc, char **argv) { @@ -360,7 +348,7 @@ reschedule(void) // skip normal threads sometimes // (twice as probable per priority level) - if ((_rand() >> (15 - priorityDiff)) != 0) + if ((fast_random_value() >> (15 - priorityDiff)) != 0) break; nextThread = lowerNextThread;