lyndseybrowning / trie-prefix-tree

Create and modify trie prefix structures and extract word lists including prefixes, anagrams and sub-anagrams
48 stars 14 forks source link

Feature request: get random word at prefix #5

Closed fzembow closed 6 years ago

fzembow commented 6 years ago

Hi!

Thanks for this helpful library, useful when thinking of how to make word games :)

I'm interested in picking a random word at a prefix. I know that it's possible to do by first trie.getPrefix(prefix) and then pick randomly from that array, but it seems inefficient given that it doesn't take advantage of the underlying trie structure.