Displaying 8 results from an estimated 8 matches for "dqrng".
2018 Sep 20
5
Bias in R's random integers?
...ot provide access
to the random bits generated by the RNG. Only a float in (0,1) is
available via unif_rand(). However, if one is willing to use an external
RNG, it is of course possible. After reading about Lemire's work [1], I
had planned to integrate such an unbiased sampling scheme into the dqrng
package, which I have now started. [2]
Using Duncan's example, the results look much better:
> library(dqrng)
> m <- (2/5)*2^32
> y <- dqsample(m, 1000000, replace = TRUE)
> table(y %% 2)
0 1
500252 499748
Currently I am taking the other interpretation of "t...
2018 Sep 20
0
Bias in R's random integers?
...andom bits. (The low order bits
are the questionable ones. 25 is just a guess, not a guarantee.)
However, if one is willing to use an external
> RNG, it is of course possible. After reading about Lemire's work [1], I
> had planned to integrate such an unbiased sampling scheme into the dqrng
> package, which I have now started. [2]
>
> Using Duncan's example, the results look much better:
>
>> library(dqrng)
>> m <- (2/5)*2^32
>> y <- dqsample(m, 1000000, replace = TRUE)
>> table(y %% 2)
>
> 0 1
> 500252 499748
Anoth...
2018 Sep 20
4
Bias in R's random integers?
...ts
> are the questionable ones. 25 is just a guess, not a guarantee.)
>
> However, if one is willing to use an external
>
> > RNG, it is of course possible. After reading about Lemire's work [1], I
> > had planned to integrate such an unbiased sampling scheme into the dqrng
> > package, which I have now started. [2]
> >
> > Using Duncan's example, the results look much better:
> >> library(dqrng)
> >> m <- (2/5)*2^32
> >> y <- dqsample(m, 1000000, replace = TRUE)
> >> table(y %% 2)
> >>
> &g...
2018 Sep 21
0
Bias in R's random integers?
...s just a guess, not a guarantee.)
> >
> > However, if one is willing to use an external
> >
> > > RNG, it is of course possible. After reading about Lemire's work [1], I
> > > had planned to integrate such an unbiased sampling scheme into the
> > > dqrng
> > > package, which I have now started. [2]
> > >
> > > Using Duncan's example, the results look much better:
> > >> library(dqrng)
> > >> m <- (2/5)*2^32
> > >> y <- dqsample(m, 1000000, replace = TRUE)
> > >> t...
2018 Sep 21
3
Bias in R's random integers?
...s, not a guarantee.)
>>>
>>> However, if one is willing to use an external
>>>
>>>> RNG, it is of course possible. After reading about Lemire's work [1], I
>>>> had planned to integrate such an unbiased sampling scheme into the
>>>> dqrng
>>>> package, which I have now started. [2]
>>>>
>>>> Using Duncan's example, the results look much better:
>>>>> library(dqrng)
>>>>> m <- (2/5)*2^32
>>>>> y <- dqsample(m, 1000000, replace = TRUE)
>>&...
2018 Sep 19
2
Bias in R's random integers?
A quick point of order here: arguing with Duncan in this forum is
helpful to expose ideas, but probably neither side will convince the
other; eventually, if you want this adopted in core R, you'll need to
convince an R-core member to pursue this fix.
In the meantime, a good, well-tested implementation in a
user-contributed package (presumably written in C for speed) would be
enormously
2020 Jul 30
2
Seeding non-R RNG with numbers from R's RNG stream
...riables to a function in C++
3. In C++: Draw millions of times from a Categorical(p) distribution, where
"p" is recalculated after each draw based on the current state of the RVs
in my system. (The heart of this is actually a Uniform(0,1) from the
Xoshiro256+ generator as provided in the dqrng package.)
4. In R: post-process the results from the transformed space back to the
space of the parameters I'm estimating.
5. Still in R: call stats::runif to change the position in R's RNG stream
so that if the user calls the function 2 times in a row without setting the
seed, they'll...
2020 Jul 30
3
Seeding non-R RNG with numbers from R's RNG stream
Thank you for this. I'd like to be sure I understand the
intuition correctly. Is the following true from what you said?
I can just fix the seed at the C++ level and the results will still be
(pseudo) random because the initialization at the R level is (pseudo)
random.
On Thu, Jul 30, 2020 at 3:36 PM Duncan Murdoch <murdoch.duncan at gmail.com>
wrote:
> I wouldn't trust the C++