Domain Randomization for chipboard stack

Hello together,

I’m trying to do domain randomization for a stack of chipboards. I made 2 HD images (top view and side view) of the real object (single chipboard). For the virtual chipboard I used a “cube” mesh and set the HD images as texture.

Five to 30 pieces of the virt. chipboard are randomly stacked into one package. For each single board in the stack I’m using a Transform Component to do a slight translation/rotation.

As you can see in the image below tried to use the Attribute Component to change the texture. The “texture_translate” attribute of the Shader has 2 values for the translation in X and Y direction. With the settings below both values are changed. What do I have to change so that the Y value stays 0 and the X value is random between 0 and 1?

That was the first question I have…

How would you randomly stack 5 to 30 chipboards? I thought about an python script, pick a random number between 5-30 and create the stage including the boards. What’s the best solution to run the script every second where every single object in the current stage is deleted and then create a new random stack of boards?

Best regards and Thank you in advance.