C# program to generate random strings
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Program:
The source code to generate random strings is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
Here, we created a class Demo that contains two static methods GenerateString() and Main().
In the GenerateString(), we get random generated string using Path.GetRandomFileName() and then replace the '.' by exclamation sign '!' and return to the Main() method.
In the Main() method, we declared an integer variable 'i' and run a loop and get randomly generated strings and print them on the console screen.