I am making an attempt to generate random numbers that are to be calculated together, i cannot seem to make it work. i know about dwtoa, im just having probloms captureing the 2 numbers to be calculated. any ideas?

I am not able to understand the problem.

Please, provide an example or further explaination.

Please, provide an example or further explaination.

ok, I am designing a program to generate 2 random numbers of which i store into separate buffers, once these numbers are generated i want to do basic math on the two numbers, i am having probloms retreaveing the number to calculate (any better?)

edit: ill give an example (from the popular game D&D) were rolling for damage with 2 dice, shake em up real nice then roll, we roll a 4 and a 2 we want to calculate that for the total damage, so 4+2=6 so were delt 6 damage yay! ok now what im having trouble with is fetching these 2 numbers and calculateing them aganst eachother ;)

edit: ill give an example (from the popular game D&D) were rolling for damage with 2 dice, shake em up real nice then roll, we roll a 4 and a 2 we want to calculate that for the total damage, so 4+2=6 so were delt 6 damage yay! ok now what im having trouble with is fetching these 2 numbers and calculateing them aganst eachother ;)

Yes, better.

edit: ill give an example (from the popular game D&D) were rolling for damage with 2 dice, shake em up real nice then roll, we roll a 4 and a 2 we want to calculate that for the total damage, so 4+2=6 so were delt 6 damage yay! ok now what im having trouble with is fetching these 2 numbers and calculateing them aganst eachother ;)How you fetch a number depends on how you store it. Usually, a simple "mov eax, " is good enough to fetch the number.

```
```

.data

Buffer1 256 dd (?)

Buffer2 256 dd (?)

.code

mov esi, OFFSET Buffer1

mov edi, OFFSET Buffer2

mov ebx, SIZEOF Buffer1

MoreNumbers:

; store random number in buffer1

call Random

mov [esi], eax

add esi, 4

; store random number in buffer2

call Random

mov [esi], eax

add esi, 4

dec ebx

jne MoreNumbers

; Do something with random numbers...

mov esi, OFFSET Buffer1

mov edi, OFFSET Buffer2

mov ebx, SIZEOF Buffer1

MoreStuff:

mov eax, [esi]

mov edx, [edi]

xor eax, edx

xor ecx, edx

dec ebx

jne MoreStuff

Please advise more...
edit: ill give an example (from the popular game D&D) were rolling for damage with 2 dice, shake em up real nice then roll, we roll a 4 and a 2 we want to calculate that for the total damage, so 4+2=6 so were delt 6 damage yay! ok now what im having trouble with is fetching these 2 numbers and calculateing them aganst eachother ;)

```
call Roll_the_die
```

push eax ; 4 (not as random as one might think ;) )

call Roll_the_die

; 2 in EAX - wow this is too much of a coincidence! ;)

add eax, [esp] ; 4 + 2

; correct the stack ; this has nothing to do with the value of calculation

add esp, 4

Just use your favorite Random Number Generator.

Let's say die #1 is 6 sided, with values 1-6.

Die #2 is 12 sided, with values 7-18.

Damage = die #1 + die #2.

Let's say die #1 is 6 sided, with values 1-6.

Die #2 is 12 sided, with values 7-18.

Damage = die #1 + die #2.

```
[size=12] invoke myFavoriteRNG
```

; eax = random number from 0 to 2^32-1

xor edx, edx

mov ecx, 6 ; 6 sided die

div ecx ; remainder in edx is random number

; from 0 to 5

inc edx ; add 1

mov ebx, edx ; save it

invoke myFavoriteRNG ; on to the second die

xor edx, edx

shl ecx, 1 ; 12 sided die

div ecx ; remainder in edx is random number

; from 0 to 11

add edx, 7 ; add 7

add edx, ebx ; edx = damage (die1 + die2)[/size]

thanks guys, im giving the ideas a try out, havent found any probloms yet :)