I use crt_srand in WM_CREATE seeding with time and crt_rand in WM_SIZE basically, so they exist in different "blocks" or occurances.
Since the seeding only occurs once will crt_rand generate same numbers?
Judging from the source code for rand and srand, and assuming that MSVCRT.DLL is in fact multithreaded, then the seed storage should be in per-thread data, so the sequence returned by rand should be continuous from anywhere within the thread, but not across threads.
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.data
.code
newthread proc C
REPEAT 10
invoke crt_rand
print ustr$(eax),9
ENDM
print chr$(13,10)
ret
newthread endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
REPEAT 10
invoke crt_rand
print ustr$(eax),9
ENDM
print chr$(13,10)
invoke crt_srand, 1
REPEAT 20
invoke crt_rand
print ustr$(eax),9
ENDM
print chr$(13,10)
invoke crt_srand, 1
REPEAT 10
invoke crt_rand
print ustr$(eax),9
ENDM
print chr$(13,10)
invoke crt__beginthread,ADDR newthread,0,0
invoke Sleep,1000
inkey "Press any key to exit..."
exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start
41 18467 6334 26500 19169 15724 11478 29358 26962 24464
41 18467 6334 26500 19169 15724 11478 29358 26962 24464
5705 28145 23281 16827 9961 491 2995 11942 4827 5436
41 18467 6334 26500 19169 15724 11478 29358 26962 24464
41 18467 6334 26500 19169 15724 11478 29358 26962 24464
Press any key to exit...
ok thanks, i see.