Skip to content

Instantly share code, notes, and snippets.

@akako
Last active December 27, 2018 07:41
Show Gist options
  • Save akako/21f008e0e80d6389e73f32c9b6bfbfbe to your computer and use it in GitHub Desktop.
Save akako/21f008e0e80d6389e73f32c9b6bfbfbe to your computer and use it in GitHub Desktop.
public void Test(string seed)
{
var seedNum = 0;
foreach (var c in seed)
{
seedNum += (int)c;
}
return new System.Random(seedNum);
}
public void Test(string seed, int floor)
{
long randomSeed = 0;
foreach (var c in seed)
{
randomSeed = (randomSeed + (int)c) * ((int)c + floor) % Int32.MaxValue;
}
var random = new System.Random((int)randomSeed);
random.Next(100)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment