CrawfisSoftware.Noise 1.2.1

dotnet add package CrawfisSoftware.Noise --version 1.2.1
                    
NuGet\Install-Package CrawfisSoftware.Noise -Version 1.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CrawfisSoftware.Noise" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CrawfisSoftware.Noise" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="CrawfisSoftware.Noise" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CrawfisSoftware.Noise --version 1.2.1
                    
#r "nuget: CrawfisSoftware.Noise, 1.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CrawfisSoftware.Noise@1.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CrawfisSoftware.Noise&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=CrawfisSoftware.Noise&version=1.2.1
                    
Install as a Cake Tool

CrawfisSoftware.Noise

CrawfisSoftware.Noise is a small .NET library that provides a couple of common procedural noise generators.

Targets:

  • .NET Standard 2.1
  • .NET 8

Install

If you are consuming this as a NuGet package:

  • dotnet add package CrawfisSoftware.Noise

Namespace

All public types are under:

  • CrawfisSoftware.Noise

Noise ranges and conventions

Both generators in this library return float samples in the range [0, 1].

  • The Sample(...) overloads take continuous coordinates (float space).
  • The SampleLattice(...) overloads take integer lattice coordinates and apply an optional scale.
  • The Calculate*Array(...) helpers generate entire 1D/2D/3D grids by repeatedly sampling lattice coordinates.

Classes

SimplexNoise

Implementation of Perlin Simplex Noise (band-limited gradient noise).

Key points:

  • Supports 1D, 2D, and 3D sampling.
  • Deterministic when using the default constructor (fixed permutation table).
  • Can be seeded by providing a System.Random, which generates a new permutation table.
    • Note: the constructor remarks mention that using randomized permutations may introduce low-frequency aliasing.
Constructors
  • SimplexNoise()
    • Uses an internal, fixed permutation table (deterministic output across runs).
  • SimplexNoise(System.Random random)
    • Fills permutations with random bytes from random.
Sampling API
  • float Sample(float x)
  • float Sample(float x, float y)
  • float Sample(float x, float y, float z)

Each returns a float in [0, 1].

Lattice helpers
  • float SampleLattice(int x, float scale = 1)
  • float SampleLattice(int x, int y, float scale = 1)
  • float SampleLattice(int x, int y, int z, float scale = 1)

These call the corresponding Sample(...) overload using x * scale, y * scale, etc.

Array generation helpers
  • float[] Calculate1DArray(int width, float scale)
  • float[,] Calculate2DArray(int width, int height, float scale)
  • float[,,] Calculate3DArray(int width, int height, int depth, float scale)

These are convenience methods for generating grids of samples.

Example
using CrawfisSoftware.Noise;

var noise = new SimplexNoise();

// Single samples
float a = noise.Sample(0.1f);
float b = noise.Sample(12.3f, 4.56f);
float c = noise.Sample(1.0f, 2.0f, 3.0f);

// Generate a 2D heightmap
float[,] height = noise.Calculate2DArray(width: 256, height: 256, scale: 0.02f);

WhiteNoise

White noise sampler backed by a precomputed table of random integers.

Key points:

  • Supports 1D, 2D, and 3D sampling.
  • Intended for fast, simple “random-looking” values (no gradient continuity).
  • Deterministic if you pass a seeded System.Random.

Internals (useful for understanding output):

  • A table of size 1024 is filled once in the constructor.
  • Samples hash the input coordinates into the table by scaling and combining indices.
  • Output is normalized into [0, 1] using minRandomValue and maxRandomValue.
Constructors
  • WhiteNoise(System.Random random, int minRandomValue = 0, int maxRandomValue = int.MaxValue - 1)
    • Uses the provided RNG to populate the table.
    • Generated values are clamped to [minRandomValue, maxRandomValue].
  • WhiteNoise(int minRandomValue = 0, int maxRandomValue = int.MaxValue)
    • Uses a new System.Random().
Sampling API
  • float Sample(float x)
  • float Sample(float x, float y)
  • float Sample(float x, float y, float z)

Each returns a float in [0, 1].

Lattice helpers
  • float SampleLattice(int x, float scale = 1)
  • float SampleLattice(int x, int y, float scale = 1)
  • float SampleLattice(int x, int y, int z, float scale = 1)
Array generation helpers
  • float[] Calculate1DArray(int width, float scale)
  • float[,] Calculate2DArray(int width, int height, float scale)
  • float[,,] Calculate3DArray(int width, int height, int depth, float scale)
Example
using CrawfisSoftware.Noise;

// Deterministic white noise
var rng = new System.Random(1234);
var noise = new WhiteNoise(rng);

float s = noise.Sample(0.42f, 1.25f);
float[,] grid = noise.Calculate2DArray(128, 128, scale: 0.1f);

Notes

  • This library focuses on lightweight sampling primitives. Any higher-level composition (octaves/fBm, domain warping, tiling, etc.) should be built on top of these samplers.

Helpers

Turbulence

Static helper for generating turbulence from SimplexNoise by summing multiple octaves.

Key points:

  • Works with 1D, 2D, and 3D simplex noise.
  • Octaves are summed using increasing frequency (lacunarity) and decreasing amplitude (gain).
  • Since SimplexNoise.Sample(...) returns values in [0, 1], turbulence is computed from the signed remap: abs(2*n - 1).

API:

  • float Turbulence.Sample(SimplexNoise noise, float x, int octaves = 4, float lacunarity = 2, float gain = 0.5f)
  • float Turbulence.Sample(SimplexNoise noise, float x, float y, int octaves = 4, float lacunarity = 2, float gain = 0.5f)
  • float Turbulence.Sample(SimplexNoise noise, float x, float y, float z, int octaves = 4, float lacunarity = 2, float gain = 0.5f)

Normalized variants (divide by total amplitude, producing values roughly in [0, 1]):

  • float Turbulence.SampleNormalized(...)

Example:

using CrawfisSoftware.Noise;

var noise = new SimplexNoise();

float t = Turbulence.SampleNormalized(noise, x: 1.25f, y: 4.5f, octaves: 6, lacunarity: 2.0f, gain: 0.5f);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.1 94 2/3/2026
1.2.0 108 1/26/2026
0.1.2 104 1/7/2026
0.1.0 100 1/7/2026

Please see CHANGELOG.md for release details.