Randomizing a simple array of strings


#1

OK, this is pretty bad for a CS grad to ask, but my brain is worn out
today.

I building a list of words (storing them in an Array).

I want to randomize the order.

Can anyone point me to a tutorial or common algorithm for that?

Thank you,

Michael G.


#2

On Wednesday 26 April 2006 2:36 pm, Michael G. wrote:

I building a list of words (storing them in an Array).

I want to randomize the order.

Can anyone point me to a tutorial or common algorithm for that?

@array.sort_by {rand}

Kirk H.


#3

Holy crap. That is beautiful.

Thank you so much.


#4

Holy crap. That is beautiful.

+1.