Skip to content

rvonmises does not respect a seed #134

@aramirezreyes

Description

@aramirezreyes

Hello! and thanks for Rfast.

After 2.0.8, it is not possible to get a reproducible stream of pseudo-random draws from the vonmises distributions via rvonmises.

R: 4.4.3
OS: RHEL Linux 9
packageVersion("Rfast")
[1] ‘2.1.5.2’

# First draw
> zigg::zsetseed(5)
> RcppZiggurat::zsetseed(5)
> set.seed(5)
> Rfast::rvonmises(n = 1, m = 5, k = 5)
[1] 5.046544
# Second draw
> zigg::zsetseed(5)
> RcppZiggurat::zsetseed(5)
> set.seed(5)
> Rfast::rvonmises(n = 1, m = 5, k = 5)
[1] 4.861319

From

return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
I understand that (in master) the RNG for rvonmises in the kappa > 0 path is always initialised with the current system time, and thus is not expected to have the functionality for external seeding. Is this correct?

In version 2.0.8, it was possible to set these two seeds and get a replicable stream of numbers:

> set.seed(5)
> RcppZiggurat::zsetseed(5)
> Rfast::rvonmises(1, 1, 10)
[1] 1.280786
> set.seed(5)
> RcppZiggurat::zsetseed(5)
> Rfast::rvonmises(1, 1, 10)
[1] 1.280786
> set.seed(5)
> RcppZiggurat::zsetseed(5)
> Rfast::rvonmises(1, 1, 10)
[1] 1.280786
> set.seed(5)
> RcppZiggurat::zsetseed(5)
> Rfast::rvonmises(1, 1, 10)
[1] 1.280786
> set.seed(5)
> RcppZiggurat::zsetseed(5)
> Rfast::rvonmises(1, 1, 10)
[1] 1.280786

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions