More random, please ! :)

Will this do?

require 'matrix'
letters = ('a'..'z').sort_by{ rand }
letters.delete('j')
m = Matrix[ letters[0..4], letters[5..9], letters[10..14],
letters[15..19], letters[20..24] ]

I think there's a method to break an array into X equal parts, but I
can't recall.

Regards,

Dan

···

-----Original Message-----
From: Meino Christian Cramer [mailto:Meino.Cramer@gmx.de]
Sent: Thursday, April 06, 2006 12:28 PM
To: ruby-talk ML
Subject: More random, please ! :slight_smile:

Hi,

recently I asked, how one would distribute all letters of
the alphabet randomly and each statistically equal handled
(oh...damn...this looks like awful german English...sorry...)

And the solution was too simple, as I would have thought
of it...hrrmmm...

And now I fear, that the next question will result again in
such simple kind of answer since we all program ruby here...:wink:

How can I distribute all 25 letters (I will skip the "J" for
this) over a 5x5 matrix (two dimensional array) that way,
that each letter is handled equally from the statistical
point of view ?