# How can I get a random number that is constant per object in a material

so i have this scene and i want to have the hue per object be random with every object but to remain constant throughout every frame each object moves as well. so the output number must be clamped between 0 and 1.I am using cycles in blender 2.75 and i have a non-composted scene and i am using the nodes. here is what i have for a scene so far:

and can i do this per particle as well? thanks for any help and if you need me to clarify feel free to ask.

## 1 Answer

OK, this is quite easily doable:

• For the per-object random, go for the "Object info"-node. It has an output called "Random", which gives out float from 0 to 1.

• For the per-particle random, go for the "Particle index"-node. It has an output called "Index". It gives out a number in a logical order. To create randomness, have it ran through the "Noise Texture"-nodes "vector" input. This will give you a random number (though for better randomness, I strongly advise you to crank up the "Detail value" to the maximum).

I hope this helps you.

For more useful tips about nodes, I strongly advise you to refer to Andrew Price's Cycles Input Encyclopedia (https://docs.google.com/document/d/1U6Ygtl7yBWi9MGcRfcEC7L4HPKCHH6t6nsqCfIutdFE/edit?usp=docslist_api) and Andrew Price's Cycles Shader Encyclopedia (https://docs.google.com/document/d/1U6Ygtl7yBWi9MGcRfcEC7L4HPKCHH6t6nsqCfIutdFE/edit?usp=docslist_api)

• DId this solve your problem? Commented Sep 16, 2015 at 5:53