Created
February 14, 2024 19:56
-
-
Save warm-ice0x00/2ac71cb2bd0bedef6d3082f3aba973bf to your computer and use it in GitHub Desktop.
This file contains 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
#include <stdio.h> | |
#include <time.h> | |
unsigned long Rand(const unsigned long x) { | |
return ((x << 16) + (x << 1) + x) & 0x7FFFFFFF; | |
} | |
unsigned long RandInt(const unsigned long x, const unsigned long a, | |
const unsigned long b) { | |
return a + x / (0x7FFFFFFF / (b - a + 1) + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment