0
$\begingroup$

I'm looking for a way to get a random value between 2 given integers.

As an example:
In this particular case I need to get a random blackbody value that's between 3000(min) and 5500(max). enter image description here

Any thoughts?
Thanks in advance!

$\endgroup$
6
$\begingroup$

This can be solved with some (for my level) clever use of the math node:

Node setup

A quick rundown of what the nodes do in this case:

Subtract: calculates the difference between your desired minimum and maximum value. In other words, the maximum amount of variation that could happen, in this case 2500.

Multiply: Multiplies the previous calculated value with the output from the Random value of the Object Info node, which lies between 0 and 1. This creates a random value between, in this case, 0 and 2500.

Add: Adds the randomly generated value of the Multiply node to the mininum value you have specified, resulting in a random number which cannot go below your desired minimum or above your desired maximum.

In this case what happens is: 3000 + value between 0 and 2500 = value between 3000 and 5500

(No i do not know the proper math symbols, but I think you get the point.)

Result:

Result

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.