Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.15 KB

File metadata and controls

41 lines (28 loc) · 1.15 KB

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.

TODO

  • Reversing tools
  • Easy libTAS system time -> equivalent InitState value (or vice versa)
  • command line functionality?

Usage

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.

See also