# Distribute random integers from interval across class

**URL:** <https://cl.desmos.com/t/distribute-random-integers-from-interval-across-class/1411>\
**Category:** Questions\
**Tags:** aggregate\
**Created:** [September 2, 2020, 1:00pm UTC](https://cl.desmos.com/t/distribute-random-integers-from-interval-across-class/1411 "2020-09-02T13:00:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Koberstein](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/nicholas_koberstein/32/137_2.png) [@Nicholas\_Koberstein](https://cl.desmos.com/u/Nicholas_Koberstein)\
**Post date:** [September 2, 2020, 1:00pm UTC](https://cl.desmos.com/t/distribute-random-integers-from-interval-across-class/1411/1 "2020-09-02T13:00:21Z")

</div>

I have been looking at the Random Number generator tool on the CL and was hoping to use it in a specific way. Is it possible to distribute the integers 1 - 24 to a class of 24 randomly so that each student has a unique value?

This would open the door to a lot of opportunities in my stats class of assigning a specific number of treatment types across the class.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [September 2, 2020, 4:57pm UTC](https://cl.desmos.com/t/distribute-random-integers-from-interval-across-class/1411/2 "2020-09-02T16:57:34Z")

</div>

I know, in a graph (which you could hide), you can take a list (1-24) and shuffle it. `L=shuffle([1,2...24])`  
Then, (I’m not certain), have an action button for students to click (it can be any button that may also have another use on the same or previous slide). Make a list that aggregates any number (so you could use a button that aggregates something else and use that list). Also, have the button `capture` the length of the aggregated list. Then use that as the index for the shuffled list. They should each get a different length (the order in which students pressed the button), but I don’t know if some lag might give students the same value. You’ll also want to disable the button once it’s pressed.

---

<div class="post-metadata">

**Author:** ![cwright4](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwright4/32/526_2.png) [@cwright4](https://cl.desmos.com/u/cwright4)\
**Post date:** [September 16, 2025, 3:45pm UTC](https://cl.desmos.com/t/distribute-random-integers-from-interval-across-class/1411/3 "2025-09-16T15:45:28Z")

</div>

Hi! Curious about if there is a resolution to this, or if the advice definitely works. I couldn’t quite replicate what was shared or get it to work, but also understand why it MIGHT be impossible for x users to have unique values from a list of y unique values (especially if x is greater than y).

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [September 16, 2025, 11:12pm UTC](https://cl.desmos.com/t/distribute-random-integers-from-interval-across-class/1411/4 "2025-09-16T23:12:06Z")

</div>

This wouldn’t have been (reliably) possible at the time, but [here’s](https://classroom.amplify.com/activity/68bc4fa86caf3d2656ea1246?state=fe7fde45-4bd2-4589-80dc-3e481828f4d7&session_state=037af0cd-be68-4a6d-a403-9c16e8acb96d&code=11aa1f7e-3c82-4818-a4ea-78d910ec749b.037af0cd-be68-4a6d-a403-9c16e8acb96d.844899f7-1da4-4b86-8db7-37048b20bd57#preview/d13f0ffd-353f-46ef-84da-4004d9838239) a way to achieve this. It’s not 100% reliable because the random float _could_ possibly duplicate, but it’s unlikely.

Essentially students are being assigned a random value which aggregates when they go to the screen, so it can almost all be in any component. There’s no shuffle function in CL, so that’s being done in the graph, but can be part of any graph. Then the value at the same index as the student’s “ID” is their assigned value. Barring the unlikely duplicate float, each student will have a unique value.
