Consider adding a Shuffle() method to nsTArrays

NEW
Unassigned

Status

()

Core
XPCOM
P5
enhancement
6 months ago
5 months ago

People

(Reporter: Mark Straver, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(firefox57 affected)

Details

(Reporter)

Description

6 months ago
On nsTArrays, we have a Sort() method to order array elements based on an arbitrary comparator. There isn't, however, a Shuffle() or Randomize() method available that would have extreme utility value (e.g. for future anti-fingerprinting or other exposure of arrays where one would want to order randomly, or even to have a utility value for exposing a Shuffle() method to web devs...).

I'd offer a patch myself but I'm apparently not familiar enough with how the templates work in nsTArrays or how to properly pass the array data back to the caller (a brief attempt at putting something in failed for a for me unknown reason; data was not re-ordered).
We'd take a patch for this, but one could also use std::random_shuffle or std::shuffle.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.