99-haskell-problems/Problems 21-28/problem_24.hs

8 lines
214 B
Haskell
Raw Normal View History

import Data.List (nub)
import System.Random (getStdGen, randomRs)
2024-05-25 19:28:16 -05:00
diffSelect :: Int -> Int -> IO [Int]
diffSelect n m = do
gen <- getStdGen
return $ take n [[1 .. m] !! x | x <- nub $ randomRs (0, m - 1) gen]