@@ -31,29 +31,23 @@ function stage(ctx, a::AllocateArray)
3131end
3232
3333function Base. rand (p:: Blocks , eltype:: Type , dims)
34- s = rand (UInt)
35- f = function (idx, x... )
36- rand (MersenneTwister (s+ idx), x... )
37- end
3834 d = ArrayDomain (map (x-> 1 : x, dims))
39- a = AllocateArray (eltype, f , d, partition (p, d), p)
35+ a = AllocateArray (eltype, (_, x ... ) -> rand (x ... ) , d, partition (p, d), p)
4036 return _to_darray (a)
4137end
4238
4339Base. rand (p:: Blocks , t:: Type , dims:: Integer... ) = rand (p, t, dims)
4440Base. rand (p:: Blocks , dims:: Integer... ) = rand (p, Float64, dims)
4541Base. rand (p:: Blocks , dims:: Tuple ) = rand (p, Float64, dims)
4642
47- function Base. randn (p:: Blocks , dims)
48- s = rand (UInt)
49- f = function (idx, x... )
50- randn (MersenneTwister (s+ idx), x... )
51- end
43+ function Base. randn (p:: Blocks , eltype:: Type , dims)
5244 d = ArrayDomain (map (x-> 1 : x, dims))
53- a = AllocateArray (Float64, f , d, partition (p, d), p)
45+ a = AllocateArray (Float64, (_, x ... ) -> randn (x ... ) , d, partition (p, d), p)
5446 return _to_darray (a)
5547end
48+ Base. randn (p:: Blocks , t:: Type , dims:: Integer... ) = randn (p, t, dims)
5649Base. randn (p:: Blocks , dims:: Integer... ) = randn (p, dims)
50+ Base. randn (p:: Blocks , dims:: Tuple ) = randn (p, Float64, dims)
5751
5852function Base. ones (p:: Blocks , eltype:: Type , dims)
5953 d = ArrayDomain (map (x-> 1 : x, dims))
0 commit comments