# Sub-list Shuffle with DesignScript not working

**URL:** <https://forum.dynamobim.com/t/sub-list-shuffle-with-designscript-not-working/48331>\
**Category:** DesignScript\
**Tags:** dynamo\
**Created:** [March 21, 2020, 8:21pm UTC](https://forum.dynamobim.com/t/sub-list-shuffle-with-designscript-not-working/48331 "2020-03-21T20:21:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![firas007noori](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/firas007noori/32/101244_2.png) [@firas007noori](https://forum.dynamobim.com/u/firas007noori)\
**Post date:** [March 21, 2020, 8:21pm UTC](https://forum.dynamobim.com/t/sub-list-shuffle-with-designscript-not-working/48331/1 "2020-03-21T20:21:52Z")

</div>

Greeting to all,  
I posted 2 days ago asking for help regarding making shuffle for a sub-list and I got great advice to regard it, which is to use some Python coding and I tried it, it was working, as I tested it in 2 laptops, both were working perfectly, today, I just restarted my laptop and run the python script, one of the laptops showing error now!! as I had no knowledge in Python I did not understand why!! any help would be really appreciated, thanks  
 ![Capture of error in python](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/4/34efce2b5dc96858e4ddb7e468701b00bc61c452.jpeg)

---

<div class="post-metadata">

**Author:** ![wouter.hilhorst](https://avatars.discourse-cdn.com/v4/letter/w/779978/32.png) [@wouter.hilhorst](https://forum.dynamobim.com/u/wouter.hilhorst)\
**Post date:** [March 21, 2020, 9:21pm UTC](https://forum.dynamobim.com/t/sub-list-shuffle-with-designscript-not-working/48331/2 "2020-03-21T21:21:00Z")

</div>

which error do you get?

---

<div class="post-metadata">

**Author:** ![firas007noori](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/firas007noori/32/101244_2.png) [@firas007noori](https://forum.dynamobim.com/u/firas007noori)\
**Post date:** [March 21, 2020, 9:34pm UTC](https://forum.dynamobim.com/t/sub-list-shuffle-with-designscript-not-working/48331/3 "2020-03-21T21:34:41Z")

</div>

Simply the shuffle not working!! and the result all “Null”

---

<div class="post-metadata">

**Author:** ![solamour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/solamour/32/153516_2.png) [@solamour](https://forum.dynamobim.com/u/solamour)\
**Post date:** [March 21, 2020, 10:49pm UTC](https://forum.dynamobim.com/t/sub-list-shuffle-with-designscript-not-working/48331/4 "2020-03-21T22:49:17Z")

</div>

Hello @firas007noori,

Please try changing your `b = {};` to `b = [];`

In Dynamo 2.0, we changed the way lists work in DesignScript, migrating from curley braces `{ }` to square braces `[]` as we split up the old lists into real Lists and Dictionaries.

Lists now use square braces: `[]`  
Dictionaries now use curley braces: `{ }`

This switch also had us deprecate (Make redundant) some old nodes, including `Count` in lieu of `List.Count`.

Please also change `n = Count(a) - 1;` to `n = List.Count(a) - 1;`

It should look as below:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/c/ccdc5f7ca7e4ac4d0f52506eaf373d904519b57c.png)

And the DesignScript code snippet:

```auto
def shuffleFix(a : var[]){
return = [Imperative]{
b = [];
n = List.Count(a) - 1;
for (_ in a)
{
    i = Math.Random(0, n);
    b = List.AddItemToEnd(a[i],b);
    a = List.RemoveItemAtIndex(a, i);
    n = n -1;
}
return = b;
}};
```
