Skip to content

Commit 863c498

Browse files
eksperimentaljosevalim
authored andcommitted
Update Enum.{random, shuffle}/1 docs to OTP 22 (#10848)
1 parent 5467b4e commit 863c498

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

lib/elixir/lib/enum.ex

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,19 +2223,17 @@ defmodule Enum do
22232223
22242224
## Examples
22252225
2226-
The examples below use the `:exrop` pseudorandom algorithm since it's
2227-
the default from Erlang/OTP 20, however if you are using Erlang/OTP 22
2228-
or above then `:exsss` is the default algorithm. If you are using `:exsplus`,
2229-
then please update, as this algorithm is deprecated since Erlang/OTP 20.
2226+
The examples below use the `:exsss` pseudorandom algorithm since it's
2227+
the default from Erlang/OTP 22:
22302228
22312229
# Although not necessary, let's seed the random algorithm
2232-
iex> :rand.seed(:exrop, {101, 102, 103})
2233-
iex> Enum.random([1, 2, 3])
2234-
3
2230+
iex> :rand.seed(:exsss, {100, 101, 102})
22352231
iex> Enum.random([1, 2, 3])
22362232
2
2233+
iex> Enum.random([1, 2, 3])
2234+
1
22372235
iex> Enum.random(1..1_000)
2238-
846
2236+
309
22392237
22402238
"""
22412239
@spec random(t) :: element
@@ -2551,17 +2549,15 @@ defmodule Enum do
25512549
25522550
## Examples
25532551
2554-
The examples below use the `:exrop` pseudorandom algorithm since it's
2555-
the default from Erlang/OTP 20, however if you are using Erlang/OTP 22
2556-
or above then `:exsss` is the default algorithm. If you are using `:exsplus`,
2557-
then please update, as this algorithm is deprecated since Erlang/OTP 20.
2552+
The examples below use the `:exsss` pseudorandom algorithm since it's
2553+
the default from Erlang/OTP 22:
25582554
25592555
# Although not necessary, let's seed the random algorithm
2560-
iex> :rand.seed(:exrop, {1, 2, 3})
2556+
iex> :rand.seed(:exsss, {1, 2, 3})
25612557
iex> Enum.shuffle([1, 2, 3])
2562-
[3, 1, 2]
2558+
[3, 2, 1]
25632559
iex> Enum.shuffle([1, 2, 3])
2564-
[1, 3, 2]
2560+
[2, 1, 3]
25652561
25662562
"""
25672563
@spec shuffle(t) :: list
@@ -3148,11 +3144,11 @@ defmodule Enum do
31483144
## Examples
31493145
31503146
# Although not necessary, let's seed the random algorithm
3151-
iex> :rand.seed(:exrop, {1, 2, 3})
3147+
iex> :rand.seed(:exsss, {1, 2, 3})
31523148
iex> Enum.take_random(1..10, 2)
3153-
[7, 2]
3149+
[3, 1]
31543150
iex> Enum.take_random(?a..?z, 5)
3155-
'hypnt'
3151+
'mikel'
31563152
31573153
"""
31583154
@spec take_random(t, non_neg_integer) :: list

lib/elixir/lib/stream.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,9 +1443,9 @@ defmodule Stream do
14431443
## Examples
14441444
14451445
# Although not necessary, let's seed the random algorithm
1446-
iex> :rand.seed(:exrop, {1, 2, 3})
1446+
iex> :rand.seed(:exsss, {1, 2, 3})
14471447
iex> Stream.repeatedly(&:rand.uniform/0) |> Enum.take(3)
1448-
[0.7498295129076106, 0.06161655489244533, 0.7924073127680873]
1448+
[0.5455598952593053, 0.6039309974353404, 0.6684893034823949]
14491449
14501450
"""
14511451
@spec repeatedly((() -> element)) :: Enumerable.t()

0 commit comments

Comments
 (0)