Fix Centurion name.
[0ad.git] / libraries / source / spidermonkey / include-win32-release / nspr / prrng.h
blob455f65d95aa90962e2279d48f0c22bd689601ff9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /*
8 ** prrng.h -- NSPR Random Number Generator
9 **
11 ** lth. 29-Oct-1999.
14 #ifndef prrng_h___
15 #define prrng_h___
17 #include "prtypes.h"
19 PR_BEGIN_EXTERN_C
22 ** PR_GetRandomNoise() -- Get random noise from the host platform
24 ** Description:
25 ** PR_GetRandomNoise() provides, depending on platform, a random value.
26 ** The length of the random value is dependent on platform and the
27 ** platform's ability to provide a random value at that moment.
29 ** The intent of PR_GetRandomNoise() is to provide a "seed" value for a
30 ** another random number generator that may be suitable for
31 ** cryptographic operations. This implies that the random value
32 ** provided may not be, by itself, cryptographically secure. The value
33 ** generated by PR_GetRandomNoise() is at best, extremely difficult to
34 ** predict and is as non-deterministic as the underlying platfrom can
35 ** provide.
37 ** Inputs:
38 ** buf -- pointer to a caller supplied buffer to contain the
39 ** generated random number. buf must be at least as large as
40 ** is specified in the 'size' argument.
42 ** size -- the requested size of the generated random number
44 ** Outputs:
45 ** a random number provided in 'buf'.
47 ** Returns:
48 ** PRSize value equal to the size of the random number actually
49 ** generated, or zero. The generated size may be less than the size
50 ** requested. A return value of zero means that PR_GetRandomNoise() is
51 ** not implemented on this platform, or there is no available noise
52 ** available to be returned at the time of the call.
54 ** Restrictions:
55 ** Calls to PR_GetRandomNoise() may use a lot of CPU on some platforms.
56 ** Some platforms may block for up to a few seconds while they
57 ** accumulate some noise. Busy machines generate lots of noise, but
58 ** care is advised when using PR_GetRandomNoise() frequently in your
59 ** application.
61 ** History:
62 ** Parts of the model dependent implementation for PR_GetRandomNoise()
63 ** were taken in whole or part from code previously in Netscape's NSS
64 ** component.
67 NSPR_API(PRSize) PR_GetRandomNoise(
68 void *buf,
69 PRSize size
72 PR_END_EXTERN_C
74 #endif /* prrng_h___ */
75 /* end prrng.h */