# Generate a Random Value between Two Limits

How do you generate a random value from between two values of my choosing? So, for example, I want to generate random evenly distributed values from between, say -.5 and 7? what is the node setup to achieve this?

Thanks JK

• You mean "random" for each object? Using the Object info node and some math or "random" through the same object (ex: per face, per vertex..)? – Carlo Jul 10 '17 at 21:36
• So you mean "random"... what? What kind of node editor are you interested in? Could you make an example of usage of this random value? – Carlo Jul 10 '17 at 21:41

Duarte Farrajota Ramos came up with a better suggestion with the Object Info > Random value. Then you just run it into a standard linear interpolation function t*(a-b)+b. If you're feeding in random numbers 0..1 it does not matter whether a<b or a>b. You still get a value in the range a..b.

The extra nodes at the bottom with the vector coordinate going into the noise texture will give you a solid color, but it will be identical on all objects that use that material.

• imgur.com/b8mputo – JKCapeTown Jul 10 '17 at 21:58
• Hi Mutant Bob - thanks - not quite right - can you see my imgur above? the material is then noisy. it should be a solid colour randomly chosen from within the wavelength limits - side question: shouldn't you subtract the small number from the large one? – JKCapeTown Jul 10 '17 at 22:00
• @JKCapeTown Adding a Normal node connected to the Vector input of the noise texture will make the color solid. – Matt Ferndz Jul 10 '17 at 23:25
• Use the same node setup, instead of a Noise texture as input use the Random socket of a Object Info node – Duarte Farrajota Ramos Jul 11 '17 at 1:46