# Randomization applied unevenly to panel system

**URL:** <https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663>\
**Category:** Revit\
**Tags:** python, dynamo\
**Created:** [January 26, 2022, 8:26pm UTC](https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663 "2022-01-26T20:26:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbt990](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cbt990](https://forum.dynamobim.com/u/cbt990)\
**Post date:** [January 26, 2022, 8:26pm UTC](https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663/1 "2022-01-26T20:26:17Z")

</div>

Hello,

I built a simple dynamo program based on a few youtube tutorials, to randomize curtain panels in a panel system. The program uses a random seed and weighted colors, along with a short python script, to randomize the color assignments.

However, the randomization always appears very inconsistent and noticeable bands of colors form. I know that probabilistically there are only 3 choices but it still seems unlikely that so many adjacent panels would be the same color.

Here is the python script:

```auto
# Load the Python Standard and DesignScript Libraries
import clr
import System.Random

min=IN[0]
max=IN[1]
amount=IN[2]
seed=IN[3]

r=System.Random(seed)
randomInts=[]
for i in range (0, amount):
	randomInts.append(r.Next(min,max+1))

OUT = randomInts

```

I have attached a picture of the result of the dyanmo run to demonstrate the color banding.

thank you for your assistance troubleshooting.

 ![Screenshot 2022-01-26 122545](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/d/1d22bcfd56c137768cc18e0aa67cdfbdb7350b96.png)

---

<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 26, 2022, 8:46pm UTC](https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663/2 "2022-01-26T20:46:10Z")

</div>

That’s random for you.

You can always manipulate the selection to favor “new” colors over the previous selection in order to introduce more control over the variance.

---

<div class="post-metadata">

**Author:** ![cbt990](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cbt990](https://forum.dynamobim.com/u/cbt990)\
**Post date:** [January 27, 2022, 4:56am UTC](https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663/3 "2022-01-27T04:56:33Z")

</div>

Nick,

Thank you for the reply. I just noticed that there is another issue which may be related, and also more in the scope of a troubleshooting issue.

When I select individual panels, the type in the browser does not match what is selected in the model. The panel color preview in the browser seems to remain red, and the name of the color does seem to change between the three desired colors, but not actually to correspond with the selected panels. So something is possibly disconnected inside.

Script attached should you be interested. Thank you-

[cp-random.dyn](https://forum.dynamobim.com/uploads/short-url/tWyuEiHM8nVuFYsJzeYdDnddfE2.dyn) (2.3 MB)

---

<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 27, 2022, 1:55pm UTC](https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663/4 "2022-01-27T13:55:32Z")

</div>

It would be easier if you posted a full image of your graph (with all preview bubbles turned on so we can see what’s going on) and some images to go with what you’re describing in the model. We can’t really do anything without an example model.

---

<div class="post-metadata">

**Author:** ![cbt990](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cbt990](https://forum.dynamobim.com/u/cbt990)\
**Post date:** [February 1, 2022, 7:35pm UTC](https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663/5 "2022-02-01T19:35:00Z")

</div>

Hi Nick,

I am debugging section by section. Here is the first part of the code. As you can see, something goes wrong between node 1 and 2.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/2/92cd819d46f4fdb7e92cd81a242563188203dd5e.jpeg)

---

<div class="post-metadata">

**Author:** ![cbt990](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cbt990](https://forum.dynamobim.com/u/cbt990)\
**Post date:** [February 1, 2022, 8:13pm UTC](https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663/6 "2022-02-01T20:13:57Z")

</div>

Run completed with warnings.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/3/f3c84022dd0d6904215dddd5976bcd6d0bb336d8.jpeg)

---

<div class="post-metadata">

**Author:** ![cbt990](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cbt990](https://forum.dynamobim.com/u/cbt990)\
**Post date:** [February 1, 2022, 8:15pm UTC](https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663/7 "2022-02-01T20:15:53Z")

</div>

Some are bounded by 6 curves which doesn’t seem correct.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/5/755c6bc5ba40a6f5fedfc67b6735eacd30c9139d.png)

---

<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:** [February 2, 2022, 2:34pm UTC](https://forum.dynamobim.com/t/randomization-applied-unevenly-to-panel-system/72663/8 "2022-02-02T14:34:14Z")

</div>

Well the first issue is that you’re selecting a `RevitLinkInstance` instead of a `CurtainSystem`. Extra boundary curves just means that a boundary is likely split by or intersecting something else. This causes Revit to count one boundary element two or more times, which is totally fine.

Can you also check your images before posting them? If you’re going to be snipping sections one at a time (rather than exporting the whole workspace at once) you need to be sure you’re zoomed in enough that the text is legible.
