Skip to content

Commit fa641c6

Browse files
antoine-levittViralBShah
authored andcommitted
Clarify the behavior of rand/randn for complex types (#33002)
1 parent 191f2ae commit fa641c6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

stdlib/Random/src/Random.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ Pick a random element or array of random elements from the set of values specifi
306306
* an `AbstractDict` or `AbstractSet` object,
307307
* a string (considered as a collection of characters), or
308308
* a type: the set of values to pick from is then equivalent to `typemin(S):typemax(S)` for
309-
integers (this is not applicable to [`BigInt`](@ref)), and to ``[0, 1)`` for floating
310-
point numbers;
309+
integers (this is not applicable to [`BigInt`](@ref)), to ``[0, 1)`` for floating
310+
point numbers and to ``[0, 1)+i[0, 1)]`` for complex floating point numbers;
311311
312312
`S` defaults to [`Float64`](@ref).
313313

stdlib/Random/src/normal.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Optionally generate an array of normally-distributed random numbers.
1818
The `Base` module currently provides an implementation for the types
1919
[`Float16`](@ref), [`Float32`](@ref), and [`Float64`](@ref) (the default), and their
2020
[`Complex`](@ref) counterparts. When the type argument is complex, the values are drawn
21-
from the circularly symmetric complex normal distribution.
21+
from the circularly symmetric complex normal distribution of variance 1 (corresponding to real and imaginary part having independent normal distribution with mean zero and variance `1/2`).
2222
2323
# Examples
2424
```jldoctest

0 commit comments

Comments
 (0)