MIPS 32程序:随机整数数组

MIPS 32程序:随机整数数组,mips,mips32,Mips,Mips32,我正在尝试一个程序,它可以生成一个由12个数字58到768之间的随机整数组成的数组。我不知道如何修改它以使最小值为58并将其保存到数组中。它可以为spacestr生成整数,但我不知道如何使它进入数组并设置最小值 .data spacestr: .asciiz " " array: .space 48 .text # get the time li $v0, 30 # gets time in milliseconds syscall move $t0, $a0 # se

我正在尝试一个程序,它可以生成一个由12个数字58到768之间的随机整数组成的数组。我不知道如何修改它以使最小值为58并将其保存到数组中。它可以为spacestr生成整数,但我不知道如何使它进入数组并设置最小值

.data
spacestr: .asciiz " "
array: .space 48

.text
# get the time
li $v0, 30 # gets time in milliseconds
syscall

move $t0, $a0

# seed the random generator (just once)
li $a0, 1 # random generator id
move $a1, $t0 # seed from time
li $v0, 40 # seed random number generator syscall
syscall

# seeding done

# generate 12 random integers from the seeded generator
li $t2, 13 # max number of iterations + 1
li $t3, 0 # current iteration number

LOOP:
li $a0, 1 # id is the same as random generator id
li $a1, 768 # upper bound of range
li $v0, 42 # random int range ???
syscall

# $a0 holds the random number

# loop terminating condition
addi $t3, $t3, 1 # increment the number of iterations
beq $t3, $t2, EXIT # branch to EXIT if iterations is 12

#a0 still holds random number so print it
li $v0, 1 # print integer syscall
syscall

# print a space
la $a0, spacestr # load the address of the string
li $v0, 4 # print string syscall
syscall

# do another iteration
j LOOP

# exit program
EXIT:

li $v0, 10 # exit syscall
syscall

生成随机数后添加最小值。@Michael我如何才能将这些值保存到数组中?使用存储指令之一。@Michael我如何才能继续使用存储指令?从一个工作示例开始,并根据需要进行编辑。有很多小样本程序可以将用户数据输入数组并选择“最小”或“最大”,等等。。