JuliaRandom / JuliaRandom/RandomNumbers.jl

Generic gen_seed method

Đang mở
#36 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Julia
Star
100
Fork
23
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I see that `gen_seed` is a common function for all RNGs in `RandomNumbers`. It would be useful to able to call `gen_seed(rng)` and have it return the appropriately sized tuple for that rng. This could make code more generic.
I can't see whether this is currently possible. My workaround has been:

```
Base.length(::Type{NTuple{N,T}}) where {N,T} = N
seed_length(rng) = length(seed_type(rng))
gen_seed(rng::RandomNumbers.AbstractRNG) = gen_seed(output_type(rng), seed_length(rng))
```

Not sure if `Base.length` is the right function to extend here, or if there already exists a function for this.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Search the RandomNumbers.jl sources for gen_seed, seed_type, output_type, and AbstractRNG to understand the existing seed API. Compare the requested gen_seed(rng) behavior with the current RNG implementations and the workaround in the issue. Done means a generic call returns an appropriately sized tuple for each RNG and the relevant tests cover that behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
julia
Lĩnh vực
backend
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.