Sha256: bc3f0043476f615056b10be18aa74181cea5a3a6e86ce86cfeeb3347c4653fa1
Contents?: true
Size: 686 Bytes
Versions: 396
Compression:
Stored size: 686 Bytes
Contents
module RobotName let random = System.Random() type Robot = { name: string } let letters = ['A'..'Z'] let digits = ['0'..'9'] let NumberOfLetters = 2; let NumberOfDigits = 3 let takeRandomElements xs length = List.init length (fun _ -> List.item (random.Next(List.length xs)) xs) let generateRandomString chars length = new System.String(takeRandomElements chars length |> List.toArray) let generateLetters() = generateRandomString letters NumberOfLetters let generateDigits() = generateRandomString digits NumberOfDigits let generateName() = generateLetters() + generateDigits() let mkRobot() = { name = generateName() } let name robot = robot.name let reset _ = mkRobot()
Version data entries
396 entries across 396 versions & 1 rubygems