dimanche 17 décembre 2017

x86 - Seeding a Random Number using the C Library

I am trying to seed the random function from the C-Library to get a truely random value. I tried using the extern 'rand', 'random', and 'srand'. Both rand and random give me the same results, and srand returns 0.

segment .data
  list: db 'rand %d', 1

segment .text
  extern printf, rand
  global main

main:
  call    rand
  mov     esi, eax
  mov     edi, list
  xor     eax, eax
  call    print f
  mov     rax, 0
  ret

I appreciate any hints to my problem. Thank you!




Aucun commentaire:

Enregistrer un commentaire