Hey everyone, i'm new in assembly 32 bits. I would like to know how can i generate a random number in range 0 - 255 in assembly 32 bits (Linux). I already implemented a code :
segment .data
msg: db "Enter number between 255 et 0 :"
len: equ $-msg
nom_fic: db "/dev/urandom", 0
segment .bss
choice: resb 17 ;
len_choice: resb 1
buffer: dd 0
segment .text
global _start ;
_start:
mov eax, 5 ; open file
mov ebx, nom_fic ;file name
mov ecx, 0 ; options
int 0x80 ;
push eax ;
mov eax, 3
pop eax ;
mov ebx, eax ;
mov ecx, buffer
mov ebx,1
int 0x80
mov eax, 4
mov ebx, 0
mov ecx, msg
mov edx, len
int 0x80
mov eax, 4
mov ebx, 0
mov ecx, buffer
mov edx, 1
int 0x80
mov eax, 6
int 0x80
mov ebx, 0 ;
mov eax, 1 ;
int 0x80 ;
As i said, i'm only a beginner, i can't translate what i want into a code, so please implement a code. Thank you so much !