Skip to content

Instantly share code, notes, and snippets.

@JohannesLoot
Created February 8, 2022 10:12
Show Gist options
  • Select an option

  • Save JohannesLoot/d8b88d9f5edc1fbed581bb52e004401a to your computer and use it in GitHub Desktop.

Select an option

Save JohannesLoot/d8b88d9f5edc1fbed581bb52e004401a to your computer and use it in GitHub Desktop.
using System;
public static class Rand
{
public static int RandomRange(UInt32 seed, int min, int max)
{
// Shift around
seed ^= seed << 21;
seed ^= seed >> 35;
seed ^= seed << 4;
// Convert the value to our range
int value = (int)(seed % max);
// Return the value
return value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment