A Shortcut for Randomly Calling on Students

Screenshot of the shortcutScreenshot of the shortcut

Calling on students in class is, perhaps surprisingly, one of the things I find challenging. I’ve never been wholly comfortable cold-calling on students, but always calling on volunteers limits opportunities for more timid students to contribute.

One way to make cold-calling less off-putting is to call on students randomly. There are applications for both iOS and Android devices that will do that, of course — but some do more than I need, and/or there’s a monetary cost to unlocking their full functionality. So I wondered whether I might be able to create a solution for myself, using Shortcuts.

Yes, as it turns out, though it took me a while. My initial idea was to randomly choose a student from a class list, then remove that student from the list (I wouldn’t want to call on the same student twice until everyone’s had a chance to respond) and choose again, repeating the process until all students had been selected.

In JavaScript, it would look something like this:

// Randomly remove one student from a list, and repeat until no students remain.

arr = ["Harry", "Hermione", "Ron", "Draco"];

let i = arr.length;

while (i > 0){
    j = getRandomInt(i);
    console.log("The selected student is " + arr[j]);
    arr.splice(j, 1);

console.log("All students have been called on.");

function getRandomInt(max) {
    return Math.floor(Math.random() * max);

The problem was, I couldn’t figure out how to do that in Shortcuts, which doesn’t appear to have the equivalent of a while loop. After banging my head against the proverbial wall for far too long, I realized I needed to change my approach to the problem of avoiding repeats. Instead of randomly selecting a student from the list and removing them, what I needed to do was randomize the list itself. Then all I’d have to do is iterate through the entire list.

That approach worked! For any who’d find it useful, here’s the shortcut:

Call on random student

It will work on macOS, iOS, and iPadOS devices, provided that Sindre Sorhus’s Actions application is installed on the device.

As written, the shortcut will work with multiple classes; when the shortcut runs, it will ask for a properly-formatted file1 with a list of student names. However, users who’d like to make a copy for each class can simply duplicate the shortcut, delete all steps through the first Repeat with each” action, and enter names directly into the List (replace list_items” with the list of names).

  1. One name per line, with no carriage return after the final name.↩︎

Up next The Bento Method With Things and Obisidian Python Scripts for Duplicating Files and Folders
Latest posts A Shortcut for Creating Random Groups Data Design and Shortcuts Duplicating Files and Folders With Shortcuts Python Scripts for Duplicating Files and Folders A Shortcut for Randomly Calling on Students The Bento Method With Things and Obisidian Importing a WordPress Xml File WordPress Export Some Thoughts on Austin Kleon’s Show Your Work! Adding Google Fonts to a Ghost Theme A Course Planning Template An Unexpected Use for a Raspberry Pi One Year Ago… Sabbatical Diary: Thinking About Grades Paperless Handwritten Feedback Filenames and LaTeX and Pandoc, Oh My! Collecting Student Work With Google Forms