Random sample data

@robertzk i've added documents, params <- list(...) and the stopifnot condition in the end
The stopifnot needs to be in the `if` statement below