randomRIO haskell

To generate a random number within a given range in Haskell, you can use the randomRIO function from the System.Random module. Here's an example:

import System.Random

main :: IO ()
main = do
  let minVal = 1
      maxVal = 10
  randomNum <- randomRIO (minVal, maxVal)
  print randomNum

In this example, randomRIO takes a range specified by (minVal, maxVal) and returns a random number within that range. The result is then printed using print.