Can I randomize a value in a number entry field (or multiply it by a random)?

In some apps, a numerical entry field does some math for you. In blender, I’ve typed things like “1.2 +.003” and blender acts on the math and changes it to “1.203”. That’s great!

But is there a keyword or trick to tell it “multiply this value by a random number between .01 and .03” for example?

Why: I have stacks of cubes in a nice array or two. I want to slightly randomize the distance in the Apply modifier’s Relative Offset for Y… but I’m generating lots of variations and I want it to be undoable. If I can change the value in the Apply modifier to randomize a bit, I could always go back later and type a different number in the Apply modifier.

I was imagining something like entering: 1.4+(rand(.01,.03)) but that doesn’t seem to work.

there are some math functions available
as Sin Cos ect…

but Random module is not included in blender
so not available

even if you add random module in script text editor and run it
it won’t be seen by internal bl

happy bl

Thanks, RickyBlender. Looks like my best option is to make single drivers for each object’s Array Modifier’s Z distance. The driver will apply a Noise modifier to the modifier’s value. I gotta figure a way to do that to a few hundred with the least amount of repetitive mouse clicking. Wish I knew how to apply 1 driver to all of them, all at once.

Linking modifiers doesn’t work. Pasting a driver only pastes to a single object.

can always ask in python forum for codes snippet for adding driver !

here is small example adding driver



import bpy

def mydriver(x,id,mat,index,value):
    obj = bpy.data.objects[id]
    mat = obj.material_slots[mat].material
    mat.use_textures[index] = value
    return(x>0)


bpy.app.driver_namespace["mydriver"] = mydriver


but must be tune for what you needs

if you find it show it here again
might be useful for other people too!

thanks
happy bl

Thanks again; could be great for other users, but I have no idea how to use that. It’s OK; I took a totally different approach and don’t need it.

Wow, the order of operations in 3D art can really bog a person down. So little is reversible. You can get hours deep into a piece and realize that you must start over because you can’t separate some thingy from the other thingies any more.