Skip to content

Instantly share code, notes, and snippets.

@HighTeaFrog
HighTeaFrog / ContainerExtensions.cs
Created January 25, 2019 13:58
C# SortNoAlloc for List, Array, etc...
using System.Collections.Generic;
public static class ContainerExtensions
{
public static void SortNoAlloc<T>(this IList<T> list) where T : System.IComparable<T>
{
if(list.Count <= 1) return;
QuickSort(list, 0, list.Count - 1);
}
@HighTeaFrog
HighTeaFrog / UtilsCG.cginc
Created July 31, 2018 16:01
Random, Noise and Doodle Function in HLSL
float random(float2 seed)
{
return frac(sin(dot(seed.xy, float2(12.9898, 78.233))) * 43758.5453123);
}
float noise(float2 seed)
{
float2 i = floor(seed);
float2 f = frac(seed);