Dave,
The code in randf_size.asm and randf.asm was not my code and since I don’t have any memory of how it works I must not have analyzed it. I think the scatter plot test was a quick way to see if it actually worked before I bothered to analyze it, and from there I’m not sure what happened.
Looking back at it now, randf starts out by XORing a random 16-bit integer derived from nrandom with whatever junk is on the stack in the LOCAL num. Then after more manipulations that I can’t make sense of ATM, it apparently (as determined by test) returns a floating-point value somewhere between 0 and 1 on the FPU stack (like the BASIC RND function). Then randf_size multiplies this value by the specified range, and adds it to the minimum. This is the randf_size code with my modifications to display the value returned by randf on the console:
randf_size PROC, min : REAL10, max : REAL10
FLD max
FLD min
FSUB
;FLD ST ; <---<<<
invoke randf
sub esp, 8
fst QWORD PTR [esp]
printf("%f\t", QWORD PTR [esp])
add esp, 8
FMUL
FLD min
FADD
RET
randf_size ENDP
Steve,
Thanks, I had forgotten that post and that very long thread, even though I have recently been referring to code from that thread, including my own :(