# Random - negative numbers?

**URL:** <https://forum.dynamobim.com/t/random-negative-numbers/45164>\
**Category:** Uncategorized\
**Created:** [January 7, 2020, 8:03am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164 "2020-01-07T08:03:53Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![jorgensen](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jorgensen](https://forum.dynamobim.com/u/jorgensen)\
**Post date:** [January 7, 2020, 8:03am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/1 "2020-01-07T08:03:53Z")

</div>

Hi

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 🙂

Does anyone know how I can achive this?

Thanks  
Jorgensen

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/7/57980c9aeb91961411b90c65cb6e6480ab87d18c.jpeg)

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [January 7, 2020, 8:32am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/2 "2020-01-07T08:32:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jorgensen](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jorgensen](https://forum.dynamobim.com/u/jorgensen)\
**Post date:** [January 7, 2020, 10:31am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/3 "2020-01-07T10:31:25Z")

</div>

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?

Thanks  
Jorgensen

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [January 7, 2020, 11:06am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/4 "2020-01-07T11:06:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Danos](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@Danos](https://forum.dynamobim.com/u/Danos)\
**Post date:** [January 7, 2020, 11:18am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/5 "2020-01-07T11:18:39Z")

</div>

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

 ![random list](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/d/1d6d5a1011c36627a4bb2aab4396b64873289091.png)

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [January 8, 2020, 8:26am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/6 "2020-01-08T08:26:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jorgensen](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jorgensen](https://forum.dynamobim.com/u/jorgensen)\
**Post date:** [January 8, 2020, 8:40am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/7 "2020-01-08T08:40:32Z")

</div>

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.

Jorgensen

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [January 8, 2020, 9:20am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/8 "2020-01-08T09:20:18Z")

</div>

take a look at this for that:

> [@Get rotation or vector from placed families](https://forum.dynamobim.com/t/get-rotation-or-vector-from-placed-families/1004):
>
> I can query the XYZ values from an element easily with Dynamo but is it also possible to query the rotation of a placed family? what I mean by that is if I rotate a family in Revit can i query in Dynamo how much it was rotated (from its original position, not the previous position)? Any help would be appreciated. Thanks Martin

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [January 8, 2020, 1:40pm UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/9 "2020-01-08T13:40:53Z")

</div>

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.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/c/bc97a7d7c2839537c94e0e3cdff82ebc20d4b3eb.png)

---

<div class="post-metadata">

**Author:** ![jorgensen](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jorgensen](https://forum.dynamobim.com/u/jorgensen)\
**Post date:** [January 8, 2020, 3:26pm UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/10 "2020-01-08T15:26:13Z")

</div>

Hi Nick

Sorry for this noob question - but what is Clockwork?

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [January 8, 2020, 5:09pm UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/11 "2020-01-08T17:09:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [January 9, 2020, 9:39am UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/12 "2020-01-09T09:39:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [January 13, 2020, 5:44pm UTC](https://forum.dynamobim.com/t/random-negative-numbers/45164/13 "2020-01-13T17:44:49Z")

</div>

You could consider using the OOTB node _Math.RemapRange_  
 ![remap](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/1/a17677d594ce2e998af3113974389677bd9fc8e6.png)
