|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Re: RandomFileby grackle (Acolyte) |
| on Aug 03, 2000 at 21:22 UTC ( [id://26108]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
ferrency is probably right that preprocessing is the only practical
way to achieve a flat distribution (i.e., for all n-letter
words to pop up with the same frequency).
I don't have a solution that you'd want to
implement, but it's an interesting question: how would you
do this without preprocessing?
This seems like a very tough problem to me. I'm sure that preprocessing is the way to go here, but if there is an efficient way to do it with no preprocessing (either for /usr/dict/words or for an arbitrary file) it would be fascinating to see it. P.S. I don't know if the original poster wants approximately equal probabilities or not; he/she will probably use preprocessing anyway. P.P.S. In the algorithms, I'm assuming you go to the beginning of the file when you hit EOF.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||