Code de la fonction:
Code : Tout sélectionner
Func RandomLettres($strMin = "a", $strMax = "z", $szNb = 1, $szType = 0)
Local $i, $Char
For $i = 1 to $szNb
If $szType = 1 Then
$Char &= StringUpper(Chr(Random (Asc($strMin), Asc($strMax), 1)))
ElseIf $szType = 2 Then
If Random (0, 1, 1) = 0 Then
$Char &= Chr(Random (Asc($strMin), Asc($strMax), 1))
Else
$Char &= StringUpper(Chr(Random (Asc($strMin), Asc($strMax), 1)))
EndIf
Else
$Char &= Chr(Random (Asc($strMin), Asc($strMax), 1))
EndIf
Next
Return $Char
EndFunc
Code : Tout sélectionner
$exemple = RandomLettre("a","z", 2, 2)
Msgbox(0, "", $exemple & "ce sont le deux lettres choisi par RandomLettre")