Random Number Generator

  • December 19, 2020
  • Blender 2.9x
  • Render: Cycles
  • Creator: billhails
  • License: CC-0
You must be logged in to download.


If you use the Object Info or Particle info nodes' "random" output to control a Hue/Saturation/Value node, you will likely have run into a limitation. If you use the same random value to control all three of H, S and V then those values are not independant, so a particular resultant hue will always have the same saturation and value.

This little node group implements a very simple pseudo-random number generator that takes a random value between 0 and 1 as input and produces another random number in the same range as output. The output value will vary wildly for even very small changes in the input value.

You can chain random number generators together, as in the example texture provided, which uses the original Object Info Random value for the Hue, one iteration of the RNG for saturation and a second iteration for value.

The three preview images show:

  1. the blendfile as provided.
  2. an example using the nodegroup on a large array of cubes, for comparison with:
  3. an example using the same random value for H, S and V to show the limitations of a common random value.

I guess there could be many other uses for independantly varying random numbers per object/particle, the HSV example is just a common use case.

To use, choose File > link from your blendfile and browse to where you saved this file, then browse into the file, section "Node Tree" and select "New Random", then in your node editor, "add>group>New Random".

If anyone is interested, it uses the Linear Congruence Method:

X_1 = aX_0 + c mod m

after first multiplying by 2^16. Afterwards it divides the result by 2^16 to get back to the range 0-1. Values for a, c and m are somewhat arbitrary, I've chosen sqrt(2^16), (2^16)/2 and 2^16 respectively to give a good distribution.


  • billhails profile picture

    Funny, after writing this little utility I discovered blender can already do this, just add a Texture > White Noise node, set it to 1-D, plug your input random in to W and get a fresh output random from the value.

    Written July 11, 2021