Closed Bug 998206 Opened 11 years ago Closed 11 years ago

Add "shuffle" option to run reftests in random order

Categories

(Core :: Layout, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: roc, Assigned: roc)

Details

Attachments

(1 file)

No description provided.
Comment on attachment 8408790 [details] [diff] [review] fix >+ try { >+ gShuffle = prefs.getBoolPref("reftest.shuffle"); >+ } catch (e) { >+ gShuffle = false; >+ } I'm not sure which prefs go in OnRefTestLoad and which prefs go in StartTests. This seems more like the ones in StartTests. (That bit is #ifdef BOOTSTRAP, though.) >+function Shuffle(array) >+{ >+ for (var i = array.length - 1; i > 0; i--) { >+ var j = Math.floor(Math.random() * (i + 1)); >+ var temp = array[i]; >+ array[i] = array[j]; >+ array[j] = temp; >+ } >+} Maybe link to http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle in a comment? (It wasn't immediately obvious to me that the resulting positions in the array are uniformly distributed, although I think that was partly due to misreading the code the first time through.)
Attachment #8408790 - Flags: review?(dbaron) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: