Randomize order of notes

I have a container with about a thousand notes. I want to randomize their order (at present they are in the order they were entered). Is there any way to do this? Thanks for any help.

Ok, there’s no random sort feature. But if you populated a Number-type user attribute with a random number—perhaps with several decimal places, to minimise possible value collisions—you could sort the container on that attribute (perhaps with $SortAlso as ‘Name’ in case two values are the same.

So we may make a stamp like so:

$MyNumber = rand()*$ChildCount(parent);

(by all means make a user Number-type attribute of a different name and substitute appropriately.)

The container we set to sort on “MyNumber” then “Name”. Or, via code:

$Sort = "MyNumber";
$SortAlso = "Name";

But you’ve c.1k notes and don’t want to select/stamp them all the time. So let’s add a stamp to apply to the container (you could use an edict for the container). For this, we’ll leave MyNumber alone and make a user Number-type attribute called ‘RandomSort’ (setting container $Sort to ‘RandomSort’ and not ‘MyNumber’):

var vList(collect(children,$Path));
vList.each(aNote){
   $RandomSort(aNote) = rand()*$ChildCount(parent(aNote));
}
1 Like

One approach springs to mind:

  1. Populate $MyNumber of each note in the container with a random number. You could do this with a stamp, or by creating a temporary agent.

  2. Sort the container by $MyNumber.

1 Like

Thanks to both Marks for elegant solutions. Amazing the number of things Tinderbox will do easily – I don’t know any other app that could do this so readily.

3 Likes

Randomizing the order of your notes sounds like a fun challenge for me! One way to do it is by using a script or programming language to shuffle the notes randomly. If you’re comfortable with coding, you could explore options like Python or JavaScript to achieve this. Alternatively, there might be software or apps available that offer a feature to shuffle the order of items in a list or container. Keep exploring, and you’ll find a solution that works for you! And if you ever feel stuck, using a d20 roll can add a playful twist to decision-making.

Don’t overlook that action code has:

In designators: