{- |
Description: Draw random numbers
Copyright: Copyright (C) 2023 Yoo Chung
License: GPL-3.0-or-later
Maintainer: dev@chungyc.org

Some solutions to "Problems.P24" of Ninety-Nine Haskell "Problems".
-}
module Solutions.P24 (randomDraw) where

import           Problems.P23
import           System.Random

-- | Draw \(n\) different random numbers from the set \( \{ k \,|\, 1 \leq k \leq m \} \).
randomDraw :: RandomGen g => Int -> Int -> g -> ([Int], g)
randomDraw :: forall g. RandomGen g => Int -> Int -> g -> ([Int], g)
randomDraw Int
n Int
m = [Int] -> Int -> g -> ([Int], g)
forall g a. RandomGen g => [a] -> Int -> g -> ([a], g)
randomSelect [Int
1..Int
m] Int
n