JuliaRandom / JuliaRandom/RandomNumbers.jl

Generic gen_seed method

Abierto
#36 3 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
100
Forks
23
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
julia
Área
backend
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.