Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve seeding mechanism fpr problem with params #4

Open
berndbischl opened this issue May 23, 2014 · 2 comments
Open

improve seeding mechanism fpr problem with params #4

berndbischl opened this issue May 23, 2014 · 2 comments

Comments

@berndbischl
Copy link
Contributor

Also better document it on webpage

Code snippet :

objToSeed = function(x, algo="crc32") {
 library(digest)
 hash = digest(ch, algo=algo)
 strtoi(sprintf("0x%s", substr(hash, 1L, 7L)))
}

objToSeed("a2j")

@mllg
Copy link
Member

mllg commented May 23, 2014

Small typo there. And there are some clashes....

library(BBmisc)
library(digest)

objToSeed = function(x, algo="crc32") {
 hash = digest(x, algo=algo)
 strtoi(sprintf("0x%s", substr(hash, 1L, 7L)))
}

N = 1e5
x = rnorm(N)
res = viapply(rnorm(1e5), objToSeed)
(sum(duplicated(res)) - sum(duplicated(x))) / N * 100

Around 0.02% for this very basic example.

@mllg
Copy link
Member

mllg commented May 23, 2014

I got results near N / .Machine$integer.max with md5. Seems okay I guess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants