A Handcart And Mohair A Handcart And Mohair - 1 year ago 78
R Question

Questions about set.seed() in R

I understand what

does and when I might use it, but I still have many questions about the function. Here are a few:

  1. Is it possible to "reset"
    to something "more random" if you have called
    earlier in your session? Is that even necessary?

  2. Is it possible to view the seed that R is currently using?

  3. Is there a way to make
    allow alphanumeric seeds, the way one can enter them at random.org (be sure you are in the advanced mode, and see "Part 3" of the form to see what I mean)?

Answer Source

Just for fun:

set.seed.alpha <- function(x) {
  hexval <- paste0("0x",digest(x,"crc32"))
  intval <- type.convert(hexval) %% .Machine$integer.max

So you can do:

set.seed.alpha("hello world")

(in fact x can be any R object, not just an alphanumeric string)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download