F # Canopy - Generate random letters and / or numbers and use in a variable

I use F # Canopy to complete some web testing. I am trying to create and upload a random number with or without letters, it is not so important and use it to embed on my site.

The code I use

let genRandomNumbers count =
    let rnd = System.Random()
    List.init count 

let l = genRandomNumbers 1

"#CompanyName" << l()

#CompanyNameis the identifier of the item I'm trying to pass. Be that as it may, I get the error message "The expression is expected to have a type string, but here it has a list type.

Any help would be greatly appreciated.

+3
source share
1 answer

<< canopy ( , ), . , , - ( )

let randomNumString n = genRandomNumbers n |> List.map string |> List.reduce (+)

, , .

let randomNumString n = genRandomNumbers n
                         |> List.fold (fun acc i -> acc + (string i)) "" 

let rand = new System.Random()

let genRandomNumbers count = List.init count (fun _ -> rand.Next())

let randomNumString n = genRandomNumbers n |> List.map string |> List.reduce (+)

"#CompanyName" << (randomNumString 1)

, F # . << , - . , .

+2

All Articles