Skip to content

Commit 8301c02

Browse files
committed
expand some points in the README
1 parent d1477af commit 8301c02

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ This package explores a possible extension of `rand`-related
88
functionalities (from the `Random` module); the code is initially
99
taken from https://github.com/JuliaLang/julia/pull/24912.
1010
Note that type piracy is commited!
11-
While hopefully useful, this package is still very experimental, and
12-
hence unstable.
11+
While hopefully useful, this package is still experimental, and
12+
hence unstable. Design or implementation contributions are welcome.
1313

1414
This does mainly 3 things:
1515

@@ -28,6 +28,17 @@ This does mainly 3 things:
2828
3) define a `Rand` iterator, which produces lazily random values.
2929

3030

31+
Point 1) defines a `Distribution` type which is incompatible with the
32+
"Distributions.jl" package. Input on how to unify the two approaches is
33+
welcome.
34+
Point 2) goes somewhat against the trend in `Base` to create
35+
containers using their constructors -- which by the way may be
36+
achieved with the `Rand` iterator from point 3).
37+
Still, I like the terser approach here, as it simply generalizes
38+
to other containers the __current__ `rand` API creating arrays.
39+
See the issue linked above for a discussion on those topics.
40+
41+
3142
There is not much documentation for now: `rand`'s docstring is updated,
3243
and here are some examples:
3344

@@ -97,3 +108,8 @@ julia> collect(Iterators.take(Uniform(1:10), 3)) # distributions can be iterated
97108
10
98109
5
99110
```
111+
112+
In some cases, the `Rand` iterator can provide some efficiency gains compared to
113+
repeated calls to `rand`, as it uses the same mechanism as non-scalar generation.
114+
For example, given `a = zeros(10000)`,
115+
`a .+ Rand(1:1000).()` will be faster than `a .+ rand.(Ref(1:1000))`.

0 commit comments

Comments
 (0)