Skip to content

Next Method ​

Definition ​

  • Namespace: JASE
  • Assembly: JASE.dll

Overloads ​

NameDescription
int Next(int seed, int min = null, int max = null)Generates a pseudo-random integer using a Linear Congruential Generator (LCG) with the specified seed and value range.
int Next(long seed, int min = null, int max = null)Generates a pseudo-random integer using a Linear Congruential Generator (LCG) from a 64-bit seed value.

int Next(int seed, int min = null, int max = null) ​

csharp
int Next(int seed, int min = null, int max = null)

Generates a pseudo-random integer using a Linear Congruential Generator (LCG) with the specified seed and value range.

Parameters ​

NameDescription
maxThe exclusive upper bound of the generated value. Must be greater than min.
minThe inclusive lower bound of the generated value.
seedThe starting value for the LCG calculation. Calling this method with the same seed on the same day produces the same output.

Returns ​

A pseudo-random integer between min (inclusive) and max (exclusive).

Remarks ​

The multiplier used in the LCG is selected based on DateTime.UtcNow.DayOfYear, which means the output distribution changes daily even for the same seed.

If max equals MaxValue, the method returns the original seed unchanged. This is legacy behavior preserved for backwards compatibility.

int Next(long seed, int min = null, int max = null) ​

csharp
int Next(long seed, int min = null, int max = null)

Generates a pseudo-random integer using a Linear Congruential Generator (LCG) from a 64-bit seed value.

Parameters ​

NameDescription
maxThe exclusive upper bound of the generated value. Must be greater than min.
minThe inclusive lower bound of the generated value.
seedA 64-bit seed. If the seed exceeds MaxValue, it is scaled down to fit into a 32-bit range before applying the LCG.

Returns ​

A pseudo-random integer between min (inclusive) and max (exclusive).

Remarks ​

This overload normalizes large seed values and delegates to the 32-bit Next implementation.