Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ InternalSample()

int System.Random.CompatPrng.InternalSample ( )
inlinepackage

Definition at line 389 of file Random.cs.

390 {
391 int inext = _inext;
392 if (++inext >= 56)
393 {
394 inext = 1;
395 }
396 int inextp = _inextp;
397 if (++inextp >= 56)
398 {
399 inextp = 1;
400 }
401 int[] seedArray = _seedArray;
402 int num = seedArray[inext] - seedArray[inextp];
403 if (num == int.MaxValue)
404 {
405 num--;
406 }
407 if (num < 0)
408 {
409 num += int.MaxValue;
410 }
411 seedArray[inext] = num;
412 _inext = inext;
413 _inextp = inextp;
414 return num;
415 }

References System.Random.CompatPrng._inext, System.Random.CompatPrng._inextp, and System.Random.CompatPrng._seedArray.

Referenced by System.Random.CompatPrng.GetSampleForLargeRange(), System.Random.Net5CompatSeedImpl.Next(), System.Random.Net5CompatDerivedImpl.Next(), System.Random.CompatPrng.NextBytes(), and System.Random.CompatPrng.Sample().