aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/rand.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-12-04 14:34:20 +0100
committerBjörn Gustavsson <[email protected]>2015-12-07 11:40:24 +0100
commit807f0c8904be14c9088ebc41ade885ffac142b34 (patch)
tree3a5a7383c05247d3d6d92e9b6012b394a93a88a7 /lib/stdlib/src/rand.erl
parentf86828fead59ba0a28658d3f5e7d8dc80f1c73fb (diff)
downloadotp-807f0c8904be14c9088ebc41ade885ffac142b34.tar.gz
otp-807f0c8904be14c9088ebc41ade885ffac142b34.tar.bz2
otp-807f0c8904be14c9088ebc41ade885ffac142b34.zip
Correct rand:export_seed/0 when there is no prior seed
According to the documentation, rand:export_seed/0 should return 'undefined' if the seed has not been intialized. However, it will create and return a seed. That means that the following code will not work as expected: case rand:export_seed() of undefined -> rand:seen({1,2,3}); _ -> ok end, rand:uniform(Range)
Diffstat (limited to 'lib/stdlib/src/rand.erl')
-rw-r--r--lib/stdlib/src/rand.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/stdlib/src/rand.erl b/lib/stdlib/src/rand.erl
index 8e8d0bc801..dc060e82d9 100644
--- a/lib/stdlib/src/rand.erl
+++ b/lib/stdlib/src/rand.erl
@@ -63,7 +63,7 @@
%% Return algorithm and seed so that RNG state can be recreated with seed/1
-spec export_seed() -> undefined | export_state().
export_seed() ->
- case seed_get() of
+ case get(?SEED_DICT) of
{#{type:=Alg}, Seed} -> {Alg, Seed};
_ -> undefined
end.