Re: Random Color

2002-11-21 Thread Dean Herington
= randomR_Enum (minBound, maxBound) data Color = Blue | Red | Green deriving (Show, Enum, Bounded) instance Random Color where randomR = randomR_Enum random = random_EnumBounded main = do stdGen - getStdGen print (take 10 (randoms stdGen :: [Color])) Dean

Re: Random Color

2002-11-21 Thread Dean Herington
a, Bounded a, RandomGen g) = g - (a, g) random_EnumBounded = randomR_Enum (minBound, maxBound) data Color = Blue | Red | Green deriving (Show, Enum, Bounded) instance Random Color where randomR = randomR_Enum random = random_EnumBounded main = do stdGen - getStdGen

Random Color

2002-11-20 Thread Mike T. Machenry
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? I am not sure exactly how the random number generator

Re: Random Color

2002-11-20 Thread Andrew J Bromage
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

Re: Random Color

2002-11-20 Thread Mike T. Machenry
wrote: 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