Table of Contents

Class

Provides a collection of static methods for generating various noise-based values using secure and efficient 128-bit computations. The class supports one-dimensional through four-dimensional noise generation.

public static class SquirrelNoise128
Inheritance
object

Fields

DefaultNoiseType

Represents the default noise type used in the noise generation methods of the SecureNoise128 class. The default value is set to ChaChaQuarterRoundSimple.

private const NoiseType DefaultNoiseType = ChaChaQuarterRoundSimple

Field Value

NoiseType

Prime1

private const ulong Prime1 = 11400714785074694791

Field Value

ulong

Prime2

private const ulong Prime2 = 13925035116211876495

Field Value

ulong

Prime3

private const ulong Prime3 = 10511698010929265437

Field Value

ulong

Methods

Get1DNoise(ulong2, ulong2, NoiseType)

Generates a 1D deterministic pseudo-random noise value based on an integer index and a seed value.

public static uint Get1DNoise(ulong2 index, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

index ulong2

The 1D index to generate the noise for.

seed ulong2

The seed value represented as a 2D unsigned integer vector for random noise generation.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

uint

A 32-bit unsigned integer representing the noise value.

Get1DNoise01(ulong2, ulong2, NoiseType)

Generates a 1D noise value scaled to the range [0, 1], based on the given index and seed.

public static float Get1DNoise01(ulong2 index, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

index ulong2

A 2D vector representing the index coordinates of the noise function input.

seed ulong2

A 2D vector used as a seed for random noise generation.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

float

A 1D noise value in the range [0, 1].

Get1DNoiseNeg1To1(ulong2, ulong2, NoiseType)

Generates a 1D noise value within the range [-1, 1] based on the specified index and seed values.

public static float Get1DNoiseNeg1To1(ulong2 index, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

index ulong2

The 2D index wrapped in an ulong2 structure, representing the coordinates for the noise generation.

seed ulong2

The 2D seed wrapped in an ulong2 structure, representing the random seed used for noise generation.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

float

A floating-point noise value in the range [-1, 1].

Get2DNoise(ulong2, ulong2, ulong2, NoiseType)

Generates a 2D noise value based on the provided coordinates and seed.

public static uint Get2DNoise(ulong2 x, ulong2 y, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

x ulong2

The X-coordinate used for noise generation.

y ulong2

The Y-coordinate used for noise generation.

seed ulong2

A 64-bit seed for deterministic noise generation, supplied as a ulong2 value.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

uint

A 32-bit unsigned integer representing the generated 2D noise value.

Get2DNoise01(ulong2, ulong2, ulong2, NoiseType)

Generates a 2D noise value scaled to the range [0, 1], using the specified coordinates and seed.

public static float Get2DNoise01(ulong2 x, ulong2 y, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

x ulong2

The 2D coordinate value representing the x-dimension component.

y ulong2

The 2D coordinate value representing the y-dimension component.

seed ulong2

The 2D seed value influencing the random noise generation.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

float

A floating-point value in the range [0, 1] representing the generated noise value.

Get2DNoiseNeg1To1(ulong2, ulong2, ulong2, NoiseType)

Generates a 2D noise value within the range [-1, 1] using the specified coordinates and seed.

public static float Get2DNoiseNeg1To1(ulong2 x, ulong2 y, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

x ulong2

The 2D coordinate value representing the x-dimension component.

y ulong2

The 2D coordinate value representing the y-dimension component.

seed ulong2

The 2D seed value influencing the random noise generation.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

float

A floating-point value in the range [-1, 1] representing the generated noise value.

Get3DNoise(ulong2, ulong2, ulong2, ulong2, NoiseType)

Generates a 3D noise value based on the provided coordinates and seed.

public static uint Get3DNoise(ulong2 x, ulong2 y, ulong2 z, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

x ulong2

The x-coordinate represented as a 64-bit vector.

y ulong2

The y-coordinate represented as a 64-bit vector.

z ulong2

The z-coordinate represented as a 64-bit vector.

seed ulong2

A 64-bit vector used as a seed for the noise generation process.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

uint

A 32-bit unsigned integer representing the generated 3D noise value.

Get3DNoise01(ulong2, ulong2, ulong2, ulong2, NoiseType)

Generates 3D noise as a normalized float value between 0 and 1 using the provided 2D unsigned integer coordinates and seed.

public static float Get3DNoise01(ulong2 x, ulong2 y, ulong2 z, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

x ulong2

The unsigned 2D integer representing the x-coordinate.

y ulong2

The unsigned 2D integer representing the y-coordinate.

z ulong2

The unsigned 2D integer representing the z-coordinate.

seed ulong2

The unsigned 2D integer used as the seed for noise generation.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

float

A float value between 0 and 1 representing the generated 3D noise.

Get3DNoiseNeg1To1(ulong2, ulong2, ulong2, ulong2, NoiseType)

Generates a 3D noise value in the range of -1 to 1 using the provided coordinates and seed.

public static float Get3DNoiseNeg1To1(ulong2 x, ulong2 y, ulong2 z, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

x ulong2

The x-coordinate as a 64-bit unsigned integer.

y ulong2

The y-coordinate as a 64-bit unsigned integer.

z ulong2

The z-coordinate as a 64-bit unsigned integer.

seed ulong2

A 64-bit unsigned integer used as the random seed for noise generation.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

float

Get4DNoise(ulong2, ulong2, ulong2, ulong2, ulong2, NoiseType)

Generates a 4D noise value based on the provided 4D input coordinates and seed.

public static uint Get4DNoise(ulong2 x, ulong2 y, ulong2 z, ulong2 w, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

x ulong2

The 4D noise input along the x-axis, represented as a ulong2.

y ulong2

The 4D noise input along the y-axis, represented as a ulong2.

z ulong2

The 4D noise input along the z-axis, represented as a ulong2.

w ulong2

The 4D noise input along the w-axis, represented as a ulong2.

seed ulong2

A unique seed value, represented as a ulong2, used to influence the noise output.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

uint

A 32-bit unsigned integer representing the calculated noise value.

Get4DNoise01(ulong2, ulong2, ulong2, ulong2, ulong2, NoiseType)

Generates a normalized 4D noise value within the range [0, 1] based on the given input coordinates and seed values.

public static float Get4DNoise01(ulong2 x, ulong2 y, ulong2 z, ulong2 w, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

x ulong2

The first component of the 4D input coordinates, represented as a ulong2 structure.

y ulong2

The second component of the 4D input coordinates, represented as a ulong2 structure.

z ulong2

The third component of the 4D input coordinates, represented as a ulong2 structure.

w ulong2

The fourth component of the 4D input coordinates, represented as a ulong2 structure.

seed ulong2

The seed value, represented as a ulong2 structure, used to initialize the noise generation process.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

float

A floating-point number representing the 4D noise value normalized to the range [0, 1].

Get4DNoiseNeg1To1(ulong2, ulong2, ulong2, ulong2, ulong2, NoiseType)

Generates a 4D noise value in the range [-1, 1] based on the provided 4D coordinates and seed value.

public static float Get4DNoiseNeg1To1(ulong2 x, ulong2 y, ulong2 z, ulong2 w, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

x ulong2

The first 64-bit unsigned integer coordinate.

y ulong2

The second 64-bit unsigned integer coordinate.

z ulong2

The third 64-bit unsigned integer coordinate.

w ulong2

The fourth 64-bit unsigned integer coordinate.

seed ulong2

The seed value used to initialize the noise generation process.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

float

A float representing the 4D noise value in the range [-1, 1].

GetUInt128(ulong2, ulong2, NoiseType)

Generates a 128-bit pseudorandom noise value based on the provided parameters.

public static ulong2 GetUInt128(ulong2 index, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

index ulong2

The input 128-bit vector index used as part of the noise calculation.

seed ulong2

The input 128-bit vector seed that modifies the noise generation.

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

ulong2

A 128-bit pseudorandom noise value represented as a ulong2.

GetUInt64(ulong2, ulong2, NoiseType)

Generates a pseudo-random 64-bit unsigned integer based on the provided index and seed values.

public static ulong GetUInt64(ulong2 index, ulong2 seed, NoiseType type = NoiseType.ChaChaQuarterRoundSimple)

Parameters

index ulong2

The index used for noise generation, represented as a 2D vector of unsigned 64-bit integers (ulong2).

seed ulong2

The seed value for noise generation, represented as a 2D vector of unsigned 64-bit integers (ulong2).

type NoiseType

The type of noise algorithm to apply, defined by the NoiseType enumeration.

Returns

ulong

A pseudo-randomly generated 64-bit unsigned integer.