Skip to content

Instantly share code, notes, and snippets.

@OhkuboSGMS
Created July 21, 2018 09:24
Show Gist options
  • Save OhkuboSGMS/7af9132ce4e253b248f048b962bd53f8 to your computer and use it in GitHub Desktop.
Save OhkuboSGMS/7af9132ce4e253b248f048b962bd53f8 to your computer and use it in GitHub Desktop.
適当に英字を生成(using LINQ)
using System.Linq;
using Random = UnityEngine.Random;
public class DummyString
{
public static string Generate(int length)
{
return new string(Enumerable.Range(0, length).Select(i => Generate()).ToArray());
}
public static char Generate()
{
return _table[Random.Range(0,_table.Length)];
}
private const string _table ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment