in reply to easy way to get random key from hash?

Keep your jokes in an array, and have a separate hash for an index. You can still use the array directly by number, or use the index.

Or, vice-versa: make an array of hash keys that you reuse, or an array of references to the individual joke records.

A tie can provide you a collection that has all the properties you need, with all that under the covers.

—John

  • Comment on Re: easy way to get random key from hash?