Created
February 8, 2022 10:12
-
-
Save JohannesLoot/d8b88d9f5edc1fbed581bb52e004401a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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