An implementation of Unity's random number generator to aid in making TASs.
Also implements libTAS's fake /dev/urandom, if running outside of libTAS.
Based on version 2020.3.48f1. Other versions should be the same or similar.
- Reversing tools
- Easy libTAS system time -> equivalent InitState value (or vice versa)
- command line functionality?
unity_rng [system time]
Currently, it only sets the initial RNG state and doesn't do anything, but you could insert calls to Random functions inside main().
For example:
int main(int argc, char* argv[]){
if (argc > 1){
prng_state = atoi(argv[1]);
}
InitScriptingRand();
// insert calls here
printf("Random int: %i\n", RandomRangeInt(1,101));
close(urandom_fd);
return 0;
}
Will print 59, which matches what a Unity program with Random.Range(1, 101)
would output given a system time of 1 in libTAS.
- TASVideos notes
- UnyRandom - JavaScript implementation
- C# implementation