JuliaRandom / JuliaRandom/RandomNumbers.jl

Generic gen_seed method

オープン
#36 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Julia
スター
100
フォーク
23
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。