Re: [Haskell-cafe] Random numbers / monads - beginner question

2008-05-08 Thread Claude Heiland-Allen
Madoc wrote: Given a list of numbers, I want to modify each of those numbers by adding a random offset. However, each such modified number shall stay within certain bounds, given by the integers minValue and maxValue. After that, I want to continue computation with the resulting list of type

Re: [Haskell-cafe] Random numbers / monads - beginner question

2008-05-08 Thread Thomas Dinsdale-Young
Madoc wrote: Given a list of numbers, I want to modify each of those numbers by adding a random offset. However, each such modified number shall stay within certain bounds, given by the integers minValue and maxValue. After that, I want to continue computation with the resulting list of type

Re: [Haskell-cafe] Random numbers / monads - beginner question

2008-05-08 Thread Brent Yorgey
2008/5/8 Thomas Dinsdale-Young [EMAIL PROTECTED]: Madoc wrote: Given a list of numbers, I want to modify each of those numbers by adding a random offset. However, each such modified number shall stay within certain bounds, given by the integers minValue and maxValue. After that, I want to

Re: [Haskell-cafe] Random numbers / monads - beginner question

2008-05-08 Thread Henning Thielemann
On Thu, 8 May 2008, Madoc wrote: Given a list of numbers, I want to modify each of those numbers by adding a random offset. However, each such modified number shall stay within certain bounds, given by the integers minValue and maxValue. After that, I want to continue computation with the

Re: [Haskell-cafe] Random numbers / monads - beginner question

2008-05-08 Thread Sebastian Sylvan
2008/5/8 Madoc [EMAIL PROTECTED]: Hello, I am just learning Haskell. Now, I encountered something that I cannot solve by myself. Your advice will be greatly appreciated. Given a list of numbers, I want to modify each of those numbers by adding a random offset. However, each such modified

Re: [Haskell-cafe] Random numbers / monads - beginner question

2008-05-08 Thread Dan Weston
Henning Thielemann wrote: On Thu, 8 May 2008, Madoc wrote: minValue = 0::Int maxValue = 1000::Int normalize a | a minValue = minValue | a maxValue = maxValue | otherwise = a normalize' = min maxValue . max minValue There is a curiosity here. The functions