wallet-core/node_modules/es5-ext/string/random-uniq.js

14 lines
213 B
JavaScript
Raw Normal View History

2017-08-14 05:01:11 +02:00
"use strict";
2017-12-10 21:51:33 +01:00
var generated = Object.create(null), random = Math.random;
2017-08-14 05:01:11 +02:00
module.exports = function () {
var str;
do {
2017-12-10 21:51:33 +01:00
str = random()
.toString(36)
.slice(2);
} while (generated[str]);
2017-08-14 05:01:11 +02:00
return str;
};