my question is very straight forward, i want to have a function in my haskell code that works as following: i invoke it and it returns me a random Integer. I use it to generate my tetrominoes based on the generated numbers, any ideas?
EDIT, here's how my code that doenst works, looks right now the codes would be something like:
Point is a data struc that i've made by myself, it doesnt really matters. The problem with using unsafePerform is that it repeats the same number everytime
getRandomInt :: Int
getRandomInt = unsafePerformIO (getStdRandom (randomR (1, 7)))
getRandomTetromino :: [Point]
getRandomTetromino = getRT getRandomInt
getRT :: Int -> [Point]
getRT c
| c == 1 = [ Point 5 1 "T", Point 5 0 "T", Point 6 1 "T", Point 4 1 "T"]
| c == 2 = [ Point 5 1 "Z", Point 5 0 "Z", Point 4 1 "Z", Point 4 2 "Z"]
| c == 3 = [ Point 5 1 "I", Point 5 0 "I", Point 5 2 "I", Point 5 3 "I"]
| c == 4 = [ Point 5 1 "L", Point 6 1 "L", Point 4 1 "L", Point 6 0 "L"]
| c == 5 = [ Point 5 1 "J", Point 5 0 "J", Point 6 0 "J", Point 5 2 "J"]
| c == 6 = [ Point 5 1 "S", Point 5 0 "S", Point 6 0 "S", Point 4 1 "S"]
| c == 7 = [ Point 5 0 "O", Point 6 0 "O", Point 6 1 "O", Point 5 1 "O"]