When i use win32asm program

I want use some functions like randmize and rand. However i not found in msdn

hope you can help me

Thank you

Posted on 2005-09-13 11:40:26 by SexyPink
You can use the C lib's rand. There's a function nrandom in masm32.lib, maybe you can use it.
Posted on 2005-09-13 12:43:10 by roticv
Use the 'Search' function and you will find a variety of code and techniques with their pros and cons.

Regards,  P1  8)
Posted on 2005-09-13 13:14:26 by Pone
Here is an example :

.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\msvcrt.lib

rand  PROTO C

output  db 'Random number: %d',13,10,0
counter dd 10


        call init
        invoke  rand
        xor    edx,edx
        mov    ecx,20
        div    ecx
        invoke  printf,ADDR output,edx
        dec    counter
        jnz    @b
        invoke  ExitProcess,0

init PROC
        local  _st:SYSTEMTIME
        local  temp:DWORD
        invoke  GetSystemTime,ADDR _st
        xor    eax,eax
        mov    ax,_st.wMilliseconds
        push    eax
        pop    temp
        invoke  rand
        dec    temp
        jnz    @b
init ENDP
END start
Posted on 2005-09-13 13:25:26 by Vortex
Checkout http://www.asmcommunity.net/board/index.php?topic=21695.msg164351#msg164351, where I've posted the code for a random number generator.

Posted on 2005-09-13 14:22:34 by Haqa
Thank you everybody
Posted on 2005-09-15 11:14:34 by SexyPink