Random Color
Andrew J Bromage
ajb@spamcop.net
Thu, 21 Nov 2002 13:55:55 +1100
G'day all.
On Wed, Nov 20, 2002 at 08:44:36PM -0500, Mike T. Machenry wrote:
> I am trying to construct an infinate list of pairs of random colors.
> I am hung up on getting a random color. I have:
>
> data Color = Blue | Red | Green deriving (Eq, Ord, Show)
>
> am I supposed to instantiate a Random class instance from color?
You could derive instances of Enum (and possibly also Bounded) and
create random elements that way.
Cheers,
Andrew Bromage