From 26f9b93c70f7dcec7fb3c314f1f7cb271cad86da Mon Sep 17 00:00:00 2001 From: fanasina Date: Wed, 7 May 2025 23:26:48 +0200 Subject: [PATCH] tools: change xrand to normal rand c with static variable for seed call --- ytools_t/src/tools_t/tools_t.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ytools_t/src/tools_t/tools_t.c b/ytools_t/src/tools_t/tools_t.c index 532cd4a..c164625 100644 --- a/ytools_t/src/tools_t/tools_t.c +++ b/ytools_t/src/tools_t/tools_t.c @@ -4,6 +4,7 @@ #define MMOD ((1 << (POW)) - 1) #define SUBA 5 #define SUBB 8 +#if 0 int xrand(){ int mod = MMOD; // (1 << 17) - 1; int a = (1<<(POW-(SUBA))) - 1; @@ -17,7 +18,9 @@ int xrand(){ xi = xii; return xii; - /* +} +#else +int xrand(){ static bool init = true; if(init){ init = false; @@ -28,8 +31,9 @@ int xrand(){ } int ret = rand (); return ret ; -*/ } +#endif + int irand(){ int mod = MMOD; // (1 << 17) - 1; int a = (1<<(POW-(SUBA))) - 1;