open System

let extract list num = 
    let rec pick list num i = 
        match list with
        | h :: t -> 
            if i = num then h
            else pick t num (i + 1)
        | _ -> failwith "error"
    
    let getRandom = 
        let r = Random()
        fun max -> r.Next(1, max + 1)
    
    let rec extractInner list num i = 
        if i = num then []
        else (pick list (getRandom list.Length) 1) :: extractInner list num (i + 1)
    
    extractInner list num 0