Giter VIP home page Giter VIP logo

Comments (2)

eddelbuettel avatar eddelbuettel commented on July 17, 2024

Wow. That is an excellent issue ticket. The only thought I had -- and it turns out it was the right one -- is that the original article on this sample() approach via RcppArmadillo is so old ... that it was affected by the one change made in R 3.6.0. See under 'Details' in help(set.seed):

 ‘sample.kind’ can be ‘"Rounding"’ or ‘"Rejection"’, or partial
 matches to these.  The former was the default in versions prior to
 3.6.0: it made ‘sample’ noticeably non-uniform on large
 populations, and should only be used for reproduction of old
 results.  See PR#17494 for a discussion.

When I use that with your code I get same sample as sample.c gets:

> RNGkind(sample.kind="Rounding")
Warning message:
In RNGkind(sample.kind = "Rounding") : non-uniform 'Rounding' sampler used
> set.seed(7)
> (sample.r <- sample(letters, N, replace=T))
 [1] "z" "k" "d" "b" "g" "u" "i" "z" "e" "l"
> print(identical(sample.r, sample.c))
[1] TRUE
> 

I will add a note to the article.

from rcpp-gallery.

eddelbuettel avatar eddelbuettel commented on July 17, 2024

I just added short note to this piece. Thanks again for pointing this out.

from rcpp-gallery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.