Search Unity

Looking for legacy version of System.Random from .NET 3.5

Discussion in 'Scripting' started by easmussen, Jun 25, 2019.

  1. easmussen

    easmussen

    Joined:
    Aug 1, 2013
    Posts:
    4
    I mistakenly assumed that a seeded Random function (e.g. "new System.Random(123)") would always return the same pseudo-random sequence. But when I upgrade to .NET 4.x equivalent, the results have changed.

    As I use this function in map generation code, it creates ugly terrain seams for any players that started a map in standalone players built with the .NET 3.5 runtime version, and then load a new version built with 4.x.

    Ideally I would stay on Unity 2019.1, but Unity 2019.2 has a critical bugfix I need and of course this is the version that removes support for .NET 3.5.

    So is there any way to find the source code for the System.Random function that was used in the .NET 3.5 runtime that was provided with Unity 2019.1 and earlier? Then I can hardcode it in and use that instead of System.Random. I've trawled all over the web but there's a huge number of different repositories of .NET, and none of them generate the results that Unity's .NET 3.5 runtime did.

    Thanks for any suggestions!
     
  2. easmussen

    easmussen

    Joined:
    Aug 1, 2013
    Posts:
    4
    fiveampsoftware and Mnemonic426 like this.
  3. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Next returns the same sequence as expected for me on 2019. Can you share your code that produces invalid results?