pr_getrandomnoise.rst (1483B)
1 PR_GetRandomNoise 2 ================= 3 4 Produces a random value for use as a seed value for another random 5 number generator. 6 7 8 Syntax 9 ------ 10 11 .. code:: 12 13 #include <prrng.h> 14 15 NSPR_API(PRSize) PR_GetRandomNoise( 16 void *buf, 17 PRSize size 18 ); 19 20 21 Parameters 22 ~~~~~~~~~~ 23 24 The function has these parameters: 25 26 ``buf`` 27 A pointer to a caller-supplied buffer to contain the generated random 28 number. ``buf`` must be at least as large as specified in ``size``. 29 30 ``size`` 31 The size, in bytes, of the requested random number. 32 33 34 Returns 35 ~~~~~~~ 36 37 :ref:`PRSize` value equal to the size of the random number actually 38 generated, or zero. The generated size may be less than the size 39 requested. A return value of zero means that :ref:`PR_GetRandomNoise` is 40 not implemented on this platform, or there is no available noise to be 41 returned at the time of the call. 42 43 44 Description 45 ----------- 46 47 :ref:`PR_GetRandomNoise` provides a random value, depending on platform. 48 The length of the random value is dependent on the platform and its 49 ability to provide a random value at that moment. 50 51 :ref:`PR_GetRandomNoise` is intended to provide a "seed" value for a 52 another random number generator that may be suitable for cryptographic 53 operations. This implies that the random value provided may not be, by 54 itself, cryptographically secure. The value generated by 55 :ref:`PR_GetRandomNoise` is at best, extremely difficult to predict and is 56 as nondeterministic as the underlying platform permits.