Random - negative numbers?


I’m trying to create a script that random rotates a selection of families. It works ok now - but I can’t figure out how to use negative values.

An example - I would like the families to be random rotated minimum -10 degrees and maximum +10 degrees (theese numbers should be input), but I can’t figure out how to get negative numbers from Math.random.

I’m not a programmer so it’s a lot of trail and error :slight_smile:

Does anyone know how I can achive this?


Generate random numbers between the domain 0-20 and minus 10 :wink:


Hi Thomas

Thanks for the fast reply.
The user should be able to enter different numbers, so the -10 and +10 varies.

So the numbers could be -3 and +10 - is there a way to handle that?


input the domain 0-13 and minus 3 from the result.

1 Like

This would be my solution, fairly simple but it should do the trick!

If you are trying to rotate families maybe you could add + 360 somewhere

Thanks Daan

I think I need some more time to look at it - I also need to figure out how to use the families current rotation as reference.


take a look at this for that:

Clockwork has a couple nodes for normalizing values including one that will scale based on a given range, which is essentially what everyone is suggesting.

1 Like

Hi Nick

Sorry for this noob question - but what is Clockwork?

Clockwork is one of the more popular custom packages (containing many useful custom nodes). You can download it through the package manager in Dynamo.

1 Like

Yes, you could see Clockwork as downloadable content with a lot of extra nodes to use in your Dynamo Environment!

You could consider using the OOTB node Math.RemapRange