How can I select a random value from a list using F#
问题 I'm new to F# and I'm trying to figure out how to return a random string value from a list/array of strings. I have a list like this: ["win8FF40", "win10Chrome45", "win7IE11"] How can I randomly select and return one item from the list above? Here is my first try: let combos = ["win8FF40";"win10Chrome45";"win7IE11"] let getrandomitem () = let rnd = System.Random() fun (combos : string[]) -> combos.[rnd.Next(combos.Length)] 回答1: Your problem is that you are mixing Array s and F# List s ( *type