I'm astonished it happened this quickly, but I found two character seeds that produced identical numeric seeds. I won't spell both out here, but one of them is "A Reproducible Character Seed" (which is in the README). That's how I immediately knew it was a problem.
I'm labeling it a bug---it's not really a bug, per se---but it is a case where something is not working the way I want it to work. So, my intuition is this. I'm going to keep char2seed() as is for when version 0.2.0 goes on CRAN. For the next release after that, I'm going to mess with char2seed() to make it behave like this.
x <- "A Reproducible Character Seed" # set seed to
tmp <- c(1:26, 1:26, 0:9) # notice the change from 0:25 to 1:26. This is going somewhere.
names(tmp) <- c(LETTERS, letters, 0:9)
x <- gsub("[^0-9a-zA-Z]","",as.character(x))
xsplit <- tmp[ strsplit(x,'')[[1]] ]
xsplit
the_seed <- as.numeric(paste(xsplit, collapse="")) # We're just going to paste the split into a seed
the_seed # look at it
as.integer( the_seed %% (2^31-1) ) # same division as before
For old-timey's sake, I'll probably rename the current version to be something like char2seed_v1() but this will be the new char2seed() going forward.
I'm astonished it happened this quickly, but I found two character seeds that produced identical numeric seeds. I won't spell both out here, but one of them is "A Reproducible Character Seed" (which is in the README). That's how I immediately knew it was a problem.
I'm labeling it a bug---it's not really a bug, per se---but it is a case where something is not working the way I want it to work. So, my intuition is this. I'm going to keep
char2seed()
as is for when version 0.2.0 goes on CRAN. For the next release after that, I'm going to mess withchar2seed()
to make it behave like this.For old-timey's sake, I'll probably rename the current version to be something like
char2seed_v1()
but this will be the newchar2seed()
going forward.