From: Ilan Berci Date: 2009-10-21T00:26:28+09:00 Subject: Re: Randomly generated words from a set of letters unknown wrote: > > 1) Manually add the pre-defined word set to a DB table and randomly pull > a word out as needed. > > 2) Each time I need a word, build a random word from the set of letters > and compare to a dictionary somewhere to make sure I have a real English > word. > > 3) Build a complete random word set one time (as in 1 but with all > possible word combinations) and store in the DB to pull from randomly. > > > So...what would you do? 1 is probably easiest....but 2 is more > interesting for me from a problem solving standpoint. > > Just looking for some thoughts. > > Thanks, > Matt Not sure what the difference is between 1 and 3 but option number 2 can be grossly inefficient for little or no benefit. Option 3 is O(1) complexity and therefore I vote for it.. hth ilan -- Posted via http://www.ruby-forum.com/.