How to generate random strings with the GetRandomFileName function in C#

1 Answer

0 votes
using System;
using System.IO;

public class Program
{
    public static string GetRandomString() {
        string p = Path.GetRandomFileName();

        p = p.Replace(".", "");

        return p;
    }

    public static void Main(string[] args)
    {
        string str = GetRandomString();

        Console.WriteLine(str);
    }
}




/*
run:

j6buxr2953p

*/

 



answered Nov 6, 2022 by avibootz

Related questions

...