Open Myridium opened 1 year ago
I didn't even think about that use-case. I think the issue might be that internally in some places Wonderwords uses sets which have no guaranteed ordering. Setting the seed is definitely a valid concern, so I am looking for ways around that
I implemented a fix where the filter
function always returns a sorted list of words. That makes word
deterministic if the seed is specified.
Is your feature request related to a problem? Please describe. It's not possible for me to produce consistent output because there's no option to include a seed. My use-case is hashing serializable objects, and using their hash as a random seed to give them a human-readable alias which is generated using
wonderwords
.Describe the solution you'd like I'd like an option to set the seed/random state in
wonderwords
.Describe alternatives you've considered It appears that using Python's
random.seed(...)
affects the random state ofwonderwords
. However it isn't enough. It does work during a Python session (i.e. it produces consistent results), but not across different sessions.For example, consider this function:
This allows me to produce consistent output when using
random_noun(seed)
during a program. It's a 'pure function', in the sense that it gives the same output for the same input, with no (known) side effects. However, if I quit Python and run a program again, the results ofrandom_noun(seed)
are changed. This means I cannot reproduce behaviour across different runs of the program.