问题
I'm trying to generate a random integer from 0-99 (inclusive) but I'm having some difficulty finding where it stores the value to when using the 42 syscall.
So far I have:
li $a1, 100
li $v0, 42
syscall
I'm not sure where the value generated is stored so I can use it though.
回答1:
From a syscall help page: $a0
is the pseudorandom number generator id, $a1
is the upper bound, and the returned random number will also be contained in $a0
.
来源:https://stackoverflow.com/questions/8394537/generating-random-numbers-using-a-syscall