aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/doc/src
diff options
context:
space:
mode:
authorGuilherme Andrade <[email protected]>2017-03-18 12:57:19 +0000
committerGuilherme Andrade <[email protected]>2017-03-18 13:03:41 +0000
commite50f63fbb2c974b4b8ad50095ca0b16a846fc161 (patch)
treeb1bc8bc0c335ab4eff625843c49f1d89479de7cb /lib/crypto/doc/src
parentd07008a0562d1f83dcab144fdec9fd920deb2b96 (diff)
downloadotp-e50f63fbb2c974b4b8ad50095ca0b16a846fc161.tar.gz
otp-e50f63fbb2c974b4b8ad50095ca0b16a846fc161.tar.bz2
otp-e50f63fbb2c974b4b8ad50095ca0b16a846fc161.zip
Restyle crypto strong numeric generators
for usage in rand
Diffstat (limited to 'lib/crypto/doc/src')
-rw-r--r--lib/crypto/doc/src/crypto.xml28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index 0697f6a202..dc725a41be 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -662,8 +662,8 @@
you are running on does not have enough "randomness" built in.
Normally this is when either
<seealso marker="#strong_rand_bytes/1">strong_rand_bytes/1</seealso>,
- <seealso marker="#strong_rand_uniform/0">strong_rand_uniform/0</seealso> or
- <seealso marker="#strong_rand_uniform/1">strong_rand_uniform/1</seealso>
+ <seealso marker="#strong_rand_range/1">strong_rand_range/1</seealso> or
+ <seealso marker="#strong_rand_float/0">strong_rand_float/0</seealso>
throws <c>low_entropy</c></p>
</desc>
</func>
@@ -733,36 +733,36 @@
</func>
<func>
- <name>strong_rand_uniform() -> X</name>
- <fsummary>Generate a random floating point number between 0.0 and 1.0</fsummary>
+ <name>strong_rand_range(N) -> binary()</name>
+ <fsummary>Generate a random non-negative integer between 0 and N</fsummary>
<type>
- <v>X = float()</v>
+ <v>N = pos_integer() | binary()</v>
</type>
<desc>
- <p>Generates a random floating pointer number uniformly distributed
- in the value range <c><![CDATA[X, 0.0 < X < 1.0.]]></c>
+ <p>Generates a random non-negative integer uniformly distributed
+ in the value range <c><![CDATA[X, 0 =< X < N.]]></c>
Uses a cryptographically secure prng seeded and periodically mixed with operating system
provided entropy. By default this is the <c>BN_rand_range</c> method from OpenSSL.</p>
+ <p>Returns binary representation.</p>
<p>May throw exception <c>low_entropy</c> in case the random generator
failed due to lack of secure "randomness".</p>
- <note><p>The generated values shall present no more than 51 bits of effective entropy.</p></note>
</desc>
</func>
<func>
- <name>strong_rand_uniform(N) -> X</name>
- <fsummary>Generate a random positive integer between 1 and N</fsummary>
+ <name>strong_rand_float() -> X</name>
+ <fsummary>Generate a random floating point number between 0.0 and 1.0</fsummary>
<type>
- <v>N = pos_integer()</v>
- <v>X = 1..N</v>
+ <v>X = float()</v>
</type>
<desc>
- <p>Generates a a random positive integer uniformly distributed
- in the value range <c><![CDATA[X, 1 =< X =< N.]]></c>
+ <p>Generates a random floating pointer number uniformly distributed
+ in the value range <c><![CDATA[X, 0.0 =< X < 1.0.]]></c>
Uses a cryptographically secure prng seeded and periodically mixed with operating system
provided entropy. By default this is the <c>BN_rand_range</c> method from OpenSSL.</p>
<p>May throw exception <c>low_entropy</c> in case the random generator
failed due to lack of secure "randomness".</p>
+ <note><p>The generated values shall present no more than 51 bits of effective entropy.</p></note>
</desc>
</func>