# What methods do we have to get a shuffle of a list of items?

**URL:** <https://the.fmsoup.org/t/what-methods-do-we-have-to-get-a-shuffle-of-a-list-of-items/3775>\
**Category:** Lounge (Discussions)\
**Tags:** scripting\
**Created:** [November 4, 2023, 3:36am UTC](https://the.fmsoup.org/t/what-methods-do-we-have-to-get-a-shuffle-of-a-list-of-items/3775 "2023-11-04T03:36:28Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Torsten](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/torsten/32/1574_2.png) [@Torsten](https://the.fmsoup.org/u/Torsten)\
**Post date:** [November 6, 2023, 5:05pm UTC](https://the.fmsoup.org/t/what-methods-do-we-have-to-get-a-shuffle-of-a-list-of-items/3775/23 "2023-11-06T17:05:22Z")

</div>

> [@steve\_ssh](#):
>
> When set to generate a shuffled set of size 9, they are considerably lower

This definitely makes a difference!

---

<div class="post-metadata">

**Author:** ![Malcolm](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/malcolm/32/196_2.png) [@Malcolm](https://the.fmsoup.org/u/Malcolm)\
**Post date:** [November 6, 2023, 5:46pm UTC](https://the.fmsoup.org/t/what-methods-do-we-have-to-get-a-shuffle-of-a-list-of-items/3775/24 "2023-11-06T17:46:38Z")

</div>

> [@steve\_ssh](#):
>
> the above metrics is using my version of the calculation to generate a shuffled set of size 300, rather than a shuffled set of size 9.

😄 New Rankings

| Milliseconds | Seconds | Iterations | Script Name | Host |
| --- | --- | --- | --- | --- |
| 170492 | .170492 | 300 | shuffleJW\_WriteToExistingRecords\_No\_JSON | Local |
| 264597 | .264597 | 300 | shuffleJW\_WriteToNewRecords\_No\_JSON | Local |
| 348340 | .34834 | 300 | shuffleJW\_WriteToExistingRecords | Local |
| 367626 | .367626 | 300 | shuffle\_WriteToExistingRecords\_SSH | Local |
| 409174 | .409174 | 300 | shuffleJW\_WriteToNewRecords | Local |
| 488779 | .488779 | 300 | shuffle\_WriteToNewRecords\_SSH | Local |
| 510605 | .510605 | 300 | shuffle\_WriteToExistingRecords\_MF | Local |
| 595517 | .595517 | 300 | shuffle\_WriteToNewRecords\_MF | Local |

---

<div class="post-metadata">

**Author:** ![jwilling](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/jwilling/32/256_2.png) [@jwilling](https://the.fmsoup.org/u/jwilling)\
**Post date:** [November 6, 2023, 10:32pm UTC](https://the.fmsoup.org/t/what-methods-do-we-have-to-get-a-shuffle-of-a-list-of-items/3775/25 "2023-11-06T22:32:56Z")

</div>

Ah the classic benchmarking problem of comparing apples to 300 apples. 🤣

![image](https://canada1.discourse-cdn.com/flex030/uploads/fmsoup/original/2X/7/719e7a53666eb6e08b6264551b054842dde4eaa7.jpeg)

---

<div class="post-metadata">

**Author:** ![MonkeybreadSoftware](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/monkeybreadsoftware/32/361_2.png) [@MonkeybreadSoftware](https://the.fmsoup.org/u/MonkeybreadSoftware)\
**Post date:** [November 8, 2023, 8:03pm UTC](https://the.fmsoup.org/t/what-methods-do-we-have-to-get-a-shuffle-of-a-list-of-items/3775/26 "2023-11-08T20:03:07Z")

</div>

I'll add you guys a [List.Shuffle](https://www.mbsplugins.eu/ListShuffle.shtml) and [QuickList.Shuffle](https://www.mbsplugins.eu/QuickListShuffle.shtml) function to [MBS FileMaker Plugin](https://www.monkeybreadsoftware.com/filemaker/) for next version.

QuickList works then for multi line texts, too.

---

<div class="post-metadata">

**Author:** ![greenflux](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/greenflux/32/3171_2.png) [@greenflux](https://the.fmsoup.org/u/greenflux)\
**Post date:** [November 22, 2023, 6:41pm UTC](https://the.fmsoup.org/t/what-methods-do-we-have-to-get-a-shuffle-of-a-list-of-items/3775/27 "2023-11-22T18:41:24Z")

</div>

Lots of creative solutions here! I'll throw one more into the mix.

1. Add a `randomInt` calculation field: `Truncate ( (Random * 10); 0)`
2. Set the storage to: _Do not store, recalculate when needed_
3. Use **ExecuteSQL()** to get the records, ordered by this field

```auto
ExecuteSQL ( 
"SELECT * FROM Contacts ORDER BY randomInt" ;
 "" ; ""  
)

```

---

<div class="post-metadata">

**Author:** ![Malcolm](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/malcolm/32/196_2.png) [@Malcolm](https://the.fmsoup.org/u/Malcolm)\
**Post date:** [November 23, 2023, 8:35am UTC](https://the.fmsoup.org/t/what-methods-do-we-have-to-get-a-shuffle-of-a-list-of-items/3775/28 "2023-11-23T08:35:17Z")

</div>

I’ll add it to the mix. I’ll add a UNIQUE clause.

[Previous page](https://the.fmsoup.org/t/what-methods-do-we-have-to-get-a-shuffle-of-a-list-of-items/3775.md?page=1)
