Improvements to the canonical one-liner GLSL rand() for OpenGL ES 2.0

· article · Byte Blacksmith (shader-community blog post), 2013

Read the original ↗

A 2013 shader-community blog post about the pseudo-random one-liner widely known as “the canonical one-liner GLSL rand()”: fract(sin(dot(co.xy, vec2(12.9898,78.233))) * 43758.5453). Its significance for this index is documentary: the author states plainly that they do not know who first wrote the function (“I don’t know the person who first wrote it, but hats off to him/her”), even though it appears “in dozens of places on the internet” — making this post a primary trace of a genuinely unattributed folk technique. It also records that the function breaks on some mobile GPUs (Adreno 320) because their sin() does not precondition its input range, and proposes highp and argument-preconditioning fixes — evidence that techniques transmitted by copy-paste, without a specification, carry undocumented implementation assumptions. (A community blog, treated as the primary trace of the folklore, not as a peer-reviewed source.)

About

Algorithms
Sine–Fract Hash (canonical GLSL one-liner)

Last updated 2026-07-16