darn
Deliver A Random Number
Returns a random number from the hardware RNG. (L=3: Raw, L=1: Conditioned, L=0: 32-bit).
Details
The random number generator provided by this instruction is NIST SP800-90B and SP800-90C compliant to the extent possible given the completeness of the standards at the time the hardware is designed. The random number generator provides a minimum of 0.5 bits of entropy per bit.
Pseudocode Operation
if 'darn' then
RT ← random(L)
Programming Note
['The random number generator provides a minimum of 0.5 bits of entropy per bit.', 'For L=0, the random number range is 0:0xFFFFFFFF.', 'For L=1 and L=2, the random number range is 0:0xFFFFFFFF_FFFFFFFE.', 'L=3 is reserved.', 'A raw random number is unconditioned noise source output. A conditioned random number has been processed by hardware to reduce bias.', '32-bit software running in an environment that does not preserve the high-order 32 bits of GPRs across invocations of the system error handler, signal handlers, event-based branch handlers, etc., may use the L=0 variant of darn and interpret the value 0xFFFFFFFF to indicate an error condition.', 'When the error value is obtained, software is expected to repeat the operation. If a non-error value has not been obtained after several attempts, a software random number generation method should be used.']
Example
Encoding
Operands
-
RT
Target -
L
Mode