Random Special character

Hi Team,

My requirement was creating random special characters

please help me on that how to create random special characters like random string

anyone please help me on this issue

image

-------------VBS–Code----------------

Function GenerateRandomSpecialChar()
Dim specialChars
specialChars = “!@#$%^&*()_±={}|;:'<>,.?/~”

Randomize ' Initialize random number generator
Dim randomIndex
randomIndex = Int((Len(specialChars) - 1) * Rnd + 1) ' Generate random index within the range of specialChars
GenerateRandomSpecialChar = Mid(specialChars, randomIndex, 10) ' Return the randomly selected special character

End Function
’ Test the function
Dim randomSpecialChar
randomSpecialChar = GenerateRandomSpecialChar()
WScript.Echo "Random Special Character: " & randomSpecialChar


take above code and save in a text file and change text file extension as “.vbs” and double click it.

@Mada_Sai_Krishna

please check with this

New String(Enumerable.Range(33, 15).Select(Function(i) Convert.ToChar(i)).OrderBy(Function() Guid.NewGuid()).Take(8).ToArray())


image

Hi @Mada_Sai_Krishna

You can use this single syntax in Assign actvity:

randomSpecialChars = String.Join("", New String(Enumerable.Repeat("!@#$%^&*()_+{}|[]\:"";'<>?,./", 10).Select(Function(specialChars) specialChars(New Random().Next(0, specialChars.Length))).ToArray()))

Regards