Generate a random integer per row?

I would like to sort rows into a new, random order. I thought about generating a random number for each row and then sorting them by that column but I am not sure what the most efficient way to do that is. Any ideas?

Currently there is no explicit transform to generate random numbers. But you can use this in a Javascript transform:

return Math.random();

This generates a psuedo-random number between 0 and 1.

You can also use the Hash transform to create pseudo random strings from a column. But the same string will always give the same hash.

1 Like

Thank you! That Javascript looks like what I need.

1 Like