You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Long character strings to char2seed() always make a seed of 0 #5
With codename v0.5.0 (and maybe before?), strings that are longer than 9 alphanumeric characters result in the same seed: 0:
library(codename)
char2seed("My project title is really long")
#> Warning in char2seed("My project title is really long"): probable complete loss#> of accuracy in modulus#> [1] 0
char2seed("Here's another really long seed")
#> Warning in char2seed("Here's another really long seed"): probable complete loss#> of accuracy in modulus#> [1] 0
codename(type="ubuntu", "My project title is really long")
#> Warning in char2seed(seed): probable complete loss of accuracy in modulus#> [1] "sapphire stoat"
codename(type="ubuntu", "Here's another really long seed")
#> Warning in char2seed(seed): probable complete loss of accuracy in modulus#> [1] "sapphire stoat"
The documentation for char2seed() currently says
The function may warn of "loss of accuracy", but this just means you supplied it a really long character vector.
But in practice that "loss of accuracy" warning means that the really long character vector will always generate a seed of 0.
I don't know what to do about it though :( so I've just been making sure my character seeds stay at ≤9 characters
Ack just kidding, it's not a 9 character threshold. I can get it up to 17 here:
library(codename)
# 9 characters
char2seed("abcdefghi")
#> [1] 123456789# 10 and it works!
char2seed("abcdefghij")
#> [1] 1608260675# It breaks here at 18
char2seed("abcdefghijklmnopqr")
#> Warning in char2seed("abcdefghijklmnopqr"): probable complete loss of accuracy#> in modulus#> [1] 0
I've been aware of these performance issues but I'm a bit unsure how to proceed with it. I'm already kind of abusing what R's set.seed() is intended to do and there is an actual maximum integer you could set for set.seed() before R politely asks you to stop doing what you're doing. Let me look into this a bit more since it's on my radar.
Activity
andrewheiss commentedon May 16, 2023
Ack just kidding, it's not a 9 character threshold. I can get it up to 17 here:
svmiller commentedon May 16, 2023
I've been aware of these performance issues but I'm a bit unsure how to proceed with it. I'm already kind of abusing what R's
set.seed()is intended to do and there is an actual maximum integer you could set forset.seed()before R politely asks you to stop doing what you're doing. Let me look into this a bit more since it's on my radar.andrewheiss commentedon May 16, 2023
Yeah, I don't know either. Maybe just a note that any long text that triggers that warning will create the same seed?