So I was reading a few threads on this site and I found one on how to make one.. But I can\'t really find a link that explains more about how to code it.. My textbook for the co
As stated by MARS documentation (in the GUI Help > Syscalls):
random int 41 $a0 = i.d. of pseudorandom number generator (any int). $a0 contains the next pseudorandom, uniformly distributed int value from this random number generator's sequence
So
li $v0, 41 ; Service 41, random int
li $a0, 0 ; Select random generator 0
syscall ; Generate random int (returns in $a0)
li $v0, 1 ; Service 1, print int
syscall ; Print previously generated random int
Works fine for me, every time a different number is printed.
You don't need to initialize or seed a random stream before using it, you can just use stream 0.