So I am making just a small compile time RNG and having a few problems
macro getRNGF*():float =
let fh = high(uint32)
let fr = getRNG()
return fr.float / fh.float
the getRNG proc is another macro that affects some static variables declared earlier, but the problem is that nim expands the macro and gives me a static value that doesn't change with each call.
I will include the getRNG proc and the variables it affects
static:
var mz:uint32 = 36969
var mw:uint32 = 18000
macro getRNG*():uint32=
mz = (36969u32 * mz and high(uint32) + (mz shr 32))
mw = (18000u32 * mw and high(uint32) + (mw shr 32))
if mw == 0: mw = 18000
if mz == 0: mz = 36969
return (mz shl 16) + mw
so my question is if there is anyway to delay macro expansion or some work around to make getRNG's return value not static