@@ -8,8 +8,8 @@ This package explores a possible extension of `rand`-related
88functionalities (from the ` Random ` module); the code is initially
99taken from https://github.com/JuliaLang/julia/pull/24912 .
1010Note 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
1414This does mainly 3 things:
1515
@@ -28,6 +28,17 @@ This does mainly 3 things:
28283 ) 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+
3142There is not much documentation for now: ` rand ` 's docstring is updated,
3243and 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