是否有臂总成code这是接近32生成二进制位的随机数的任何具体计划? [英] Is there any specific program in arm assembly code which comes close to generating 32 bit binary random numbers?
问题描述
是否有臂总成code任何具体方案,其中接近32生成二进制位的随机数?我需要1000测试用例计划。
Is there any specific program in arm assembly code which comes close to generating 32 bit binary random numbers? I need 1000 test cases for a program.
推荐答案
在这个链接是一个PRNG 32位ARM code( xorshift 发电机):<一href=\"http://hackipedia.org/Platform/3D0/html,%203DO%20SDK%20Documentation/Type%20A/tktfldr/acbfldr/2acbh.html\" rel=\"nofollow\">http://hackipedia.org/Platform/3D0/html,%203DO%20SDK%20Documentation/Type%20A/tktfldr/acbfldr/2acbh.html
In this link is a 32-bit ARM code for a PRNG (xorshift generator): http://hackipedia.org/Platform/3D0/html,%203DO%20SDK%20Documentation/Type%20A/tktfldr/acbfldr/2acbh.html
的基本算法是newbit:= bit33 EOR故障Bit20,左移33位数字,并把在底部newbit;为所需要的所有newbits(即32位)执行此操作。整个操作可以紧凑通过最大利用ARM的桶形移位器来codeD:
The basic algorithm is newbit:=bit33 EOR bit20, shift left the 33 bit number and put in newbit at the bottom; this operation is performed for all the newbits needed (ie. 32 bits). The entire operation can be coded compactly by making maximal use of the ARM's barrel shifter:
; enter with seed in R0 (32 bits), R1 (1 bit in least significant bit)
; R2 is used as a temporary register.
; on exit the new seed is in R0 and R1 as before
; Note that a seed of 0 will always produce a new seed of 0.
; All other values produce a maximal length sequence.
;
TST R1, R1, LSR #1 ; top bit into Carry
MOVS R2, R0, RRX ; 33 bit rotate right
ADC R1, R1, R1 ; carry into lsb of R1
EOR R2, R2, R0, LSL #12 ; (involved!)
EOR R0, R2, R2, LSR #20 ; (similarly involved!)
https://en.wikipedia.org/wiki/Pseudorandom_number_generator
这篇关于是否有臂总成code这是接近32生成二进制位的随机数的任何具体计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!