It would be nice to provide a convenient, efficient way to assign ordinals to the contents of a set within a single timestep, in a deterministic way. It is easy to get determinism if we spread the assignment out over time, and there is existing code that does ordinal assignment in a single timestep (AggAssign) in the sandbox, but it is not deterministic.
This turns out to be pretty easy to solve: sort the collection (via Ruby), and then use an element's ordinal position as its ID. This should be safe, because sort should be treated as non-monotonic. Details:
It would be nice to provide a convenient, efficient way to assign ordinals to the contents of a set within a single timestep, in a deterministic way. It is easy to get determinism if we spread the assignment out over time, and there is existing code that does ordinal assignment in a single timestep (
AggAssign
) in the sandbox, but it is not deterministic.