# Is it possible to get a random number in the node editor?

Is it possible to generate a random number for use in the node editor?

I am aware of the Object Info node, but I want a random number which I have more control over.
Ideally I could change it with some sort of "seed" vale and be able to define limits for maximum and minimum values.

How is this possible?

That would be through drivers. You can add an Input->Value node to feed into other nodes or add a driver to an editable value on any other node.

A simple way to get random values is edit the value and enter #noise.random() This will give random values between 0 and 1, you can expand the entry to multiply the value if you want it larger or add a minimum value.

To get more control over the generated value you can create a script and use bpy.app.driver_namespace["name"] = funcname to provide access to any function you define. The script name must end in .py so that you can register it and auto run python scripts also needs to be enabled.

• I tried using noise.random() as a scripted expression, however the debug value stayed as 0 and it did not appear to work in a render. – gandalf3 Mar 27 '14 at 7:02
• You may need to update dependencies, but one thing I have seen stop this working is if the interpolation type of the driver is set to constant. The other is not enabling auto-run python scripts, you should see a notice if that is the case. – sambler Mar 27 '14 at 23:08
• I got it working :) I had to save the file first. Something to do with auto run perhaps? I have it enabled but with some excluded directories. – gandalf3 Mar 27 '14 at 23:25

If you are texturing, there is a "random" value in the object info node

Not entirely sure what your application is, but there's more info on the object info node at http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/More

Also found this post here on stack exchange: Random maps in cycles