# Create Random Family types on a Grid

**URL:** <https://forum.dynamobim.com/t/create-random-family-types-on-a-grid/126>\
**Category:** Packages\
**Created:** [July 27, 2013, 9:02am UTC](https://forum.dynamobim.com/t/create-random-family-types-on-a-grid/126 "2013-07-27T09:02:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![William\_Charles\_Ruff](https://avatars.discourse-cdn.com/v4/letter/w/dbc845/32.png) [@William\_Charles\_Ruff](https://forum.dynamobim.com/u/William_Charles_Ruff)\
**Post date:** [July 27, 2013, 9:02am UTC](https://forum.dynamobim.com/t/create-random-family-types-on-a-grid/126/1 "2013-07-27T09:02:19Z")

</div>

Hello,

  

I have tried a few different methods with the same result, a crash. what i am trying to do is place a combination of three different types of families on a grid in a random pattern. i can achieve everything accept for the randomization of the 'family type" or "family instance". I first tried to create a random placement of 3 family types, this method didn't work at all. the second method i tried was nesting a component with 3 family types into a family and creating an instance parameter for the type label. this works in theory but every time i try and run the script it crashes.

  
  

any suggestions would be greatly appreciated.

  

![](http://dynamobim.com/wp-content/uploads/discussions/1-1000/558-workspace.png?width=750)

  

![](http://dynamobim.com/wp-content/uploads/discussions/1-1000/560-error.JPG)

  

![](http://dynamobim.com/wp-content/uploads/discussions/1-1000/562-Image1.JPG?width=750)

  

![](http://dynamobim.com/wp-content/uploads/discussions/1-1000/564-grid.JPG?width=750)

---

<div class="post-metadata">

**Author:** ![Andreas\_Dieckmann](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andreas_dieckmann/32/365_2.png) [@Andreas\_Dieckmann](https://forum.dynamobim.com/u/Andreas_Dieckmann)\
**Post date:** [July 28, 2013, 4:07am UTC](https://forum.dynamobim.com/t/create-random-family-types-on-a-grid/126/2 "2013-07-28T04:07:10Z")

</div>

Hi William,

  

the problem with your definition is that it lacks a conditional statement that evaluates the random number and tells Dynamo which family type to pick for a specific value range of the random number.

  

Have a look at the example I posted here a few days ago: [Family Type from Image](http://autodeskvasari.com/forum/topics/parameter-values-from-image-for-dynamo?commentId=6375667%3AComment%3A57191)

  

You can use the custom node I created as a blueprint for your own evaluation function. In your case, you will have to nest two IF nodes in your custom node, because you have three family types - not unlike nesting if-statements in Revit formulas.

  

Also, when working with the random node in Dynamo, be aware of how it works. A very good explanation can be found on David Wood's blog here:

  

[http://bimwood.blogspot.co.uk/2013/07/dynamo-random-numbers.html](http://bimwood.blogspot.co.uk/2013/07/dynamo-random-numbers.html)

---

<div class="post-metadata">

**Author:** ![William\_Charles\_Ruff](https://avatars.discourse-cdn.com/v4/letter/w/dbc845/32.png) [@William\_Charles\_Ruff](https://forum.dynamobim.com/u/William_Charles_Ruff)\
**Post date:** [July 27, 2013, 9:02am UTC](https://forum.dynamobim.com/t/create-random-family-types-on-a-grid/126/3 "2013-07-27T09:02:58Z")

</div>

here is the definition
