Hello im trying to use random integer range and the values that i get is out ouf the ones that i set.
for example:
sw $a0, 0($s0)
li $a0, 1000
li $a1, 3500
li $v0, 42 #random
So i just want it to be random numbers between 1000-3500 but it gives me any random number.
Can you please help me to understand where my mistake is.
YAML is not a programming language and therefore can't generate random numbers.
$a0
is the random seed, not the lower bound. You should set $a1
to 2501
to generate 0-2500 random number, and add 1000 to the result.
sw $a0, 0($s0)
li $a1, 2501
li $v0, 42 #random
add $a0, $a0, 1000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With