To follow-up, if we avoid the cast this works just find as you'd expect: R> cppFunction("NumericVector myrunif() { return floor(runif(1000000)); }") R> for (i in 1:100) ignoreme <- myrunif() R> Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org