aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/doc/src/random.xml
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2011-05-13 14:08:25 +0200
committerHans Bolinder <[email protected]>2011-05-13 14:08:59 +0200
commit0ccc57b1e3772deaf5650077808a38a52b1133b9 (patch)
treeed98a14e3cda51c344a04c85db7843b274dfe56a /lib/stdlib/doc/src/random.xml
parent22f3c9720cb7d19a3aafac613f03aede91d6283f (diff)
parent229d0d8ca88bc344bed89e46541b325c1d267996 (diff)
downloadotp-0ccc57b1e3772deaf5650077808a38a52b1133b9.tar.gz
otp-0ccc57b1e3772deaf5650077808a38a52b1133b9.tar.bz2
otp-0ccc57b1e3772deaf5650077808a38a52b1133b9.zip
Merge branch 'hb/stdlib/doc_specs/OTP-9271' into dev
* hb/stdlib/doc_specs/OTP-9271: Use Erlang specs and types for documentation Conflicts: lib/stdlib/doc/src/timer.xml
Diffstat (limited to 'lib/stdlib/doc/src/random.xml')
-rw-r--r--lib/stdlib/doc/src/random.xml50
1 files changed, 20 insertions, 30 deletions
diff --git a/lib/stdlib/doc/src/random.xml b/lib/stdlib/doc/src/random.xml
index dcc6d756e1..93affc3191 100644
--- a/lib/stdlib/doc/src/random.xml
+++ b/lib/stdlib/doc/src/random.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>1996</year><year>2009</year>
+ <year>1996</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -49,9 +49,15 @@
strong. If a strong cryptographic random number generator is needed for
example <c>crypto:rand_bytes/1</c> could be used instead.</p>
</description>
+ <datatypes>
+ <datatype>
+ <name name="ran"/>
+ <desc><p>The state.</p></desc>
+ </datatype>
+ </datatypes>
<funcs>
<func>
- <name>seed() -> ran()</name>
+ <name name="seed" arity="0"/>
<fsummary>Seeds random number generation with default values</fsummary>
<desc>
<p>Seeds random number generation with default (fixed) values
@@ -59,11 +65,8 @@
</desc>
</func>
<func>
- <name>seed(A1, A2, A3) -> undefined | ran()</name>
+ <name name="seed" arity="3"/>
<fsummary>Seeds random number generator</fsummary>
- <type>
- <v>A1 = A2 = A3 = integer()</v>
- </type>
<desc>
<p>Seeds random number generation with integer values in the process
dictionary, and returns the old state.</p>
@@ -76,26 +79,23 @@
</desc>
</func>
<func>
- <name>seed({A1, A2, A3}) -> undefined | ran()</name>
+ <name name="seed" arity="1"/>
<fsummary>Seeds random number generator</fsummary>
- <type>
- <v>A1 = A2 = A3 = integer()</v>
- </type>
<desc>
<p>
- <c>seed({A1, A2, A3})</c> is equivalent to <c>seed(A1, A2, A3)</c>.
+ <c>seed({<anno>A1</anno>, <anno>A2</anno>, <anno>A3</anno>})</c> is equivalent to <c>seed(<anno>A1</anno>, <anno>A2</anno>, <anno>A3</anno>)</c>.
</p>
</desc>
</func>
<func>
- <name>seed0() -> ran()</name>
+ <name name="seed0" arity="0"/>
<fsummary>Return default state for random number generation</fsummary>
<desc>
<p>Returns the default state.</p>
</desc>
</func>
<func>
- <name>uniform()-> float()</name>
+ <name name="uniform" arity="0"/>
<fsummary>Return a random float</fsummary>
<desc>
<p>Returns a random float uniformly distributed between <c>0.0</c>
@@ -103,39 +103,29 @@
</desc>
</func>
<func>
- <name>uniform(N) -> integer()</name>
+ <name name="uniform" arity="1"/>
<fsummary>Return a random integer</fsummary>
- <type>
- <v>N = integer()</v>
- </type>
<desc>
- <p>Given an integer <c>N >= 1</c>, <c>uniform/1</c> returns a
+ <p>Given an integer <c><anno>N</anno> >= 1</c>, <c>uniform/1</c> returns a
random integer uniformly distributed between <c>1</c> and
- <c>N</c>, updating the state in the process dictionary.</p>
+ <c><anno>N</anno></c>, updating the state in the process dictionary.</p>
</desc>
</func>
<func>
- <name>uniform_s(State0) -> {float(), State1}</name>
+ <name name="uniform_s" arity="1"/>
<fsummary>Return a random float</fsummary>
- <type>
- <v>State0 = State1 = ran()</v>
- </type>
<desc>
<p>Given a state, <c>uniform_s/1</c>returns a random float uniformly
distributed between <c>0.0</c> and <c>1.0</c>, and a new state.</p>
</desc>
</func>
<func>
- <name>uniform_s(N, State0) -> {integer(), State1}</name>
+ <name name="uniform_s" arity="2"/>
<fsummary>Return a random integer</fsummary>
- <type>
- <v>N = integer()</v>
- <v>State0 = State1 = ran()</v>
- </type>
<desc>
- <p>Given an integer <c>N >= 1</c> and a state, <c>uniform_s/2</c>
+ <p>Given an integer <c><anno>N</anno> >= 1</c> and a state, <c>uniform_s/2</c>
returns a random integer uniformly distributed between <c>1</c> and
- <c>N</c>, and a new state.</p>
+ <c><anno>N</anno></c>, and a new state.</p>
</desc>
</func>
</funcs>