Improve randomness of UUIDs.

This commit is contained in:
Neil Fraser
2015-11-24 19:16:01 -08:00
parent a239c7207f
commit e5dfdf4658
2 changed files with 36 additions and 14 deletions

View File

@@ -20,9 +20,12 @@
'use strict';
function test_genUid() {
var a = Blockly.genUid();
var b = Blockly.genUid();
assertFalse('UUID different', a == b);
var uuids = {};
for (var i = 0; i < 1000; i++) {
var uuid = Blockly.genUid();
assertFalse('UUID different: ' + uuid, uuid in uuids);
uuids[uuid] = true;
}
}
function test_addClass() {