diff options
Diffstat (limited to 'app/scripts/lib/random-id.js')
-rw-r--r-- | app/scripts/lib/random-id.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/scripts/lib/random-id.js b/app/scripts/lib/random-id.js new file mode 100644 index 000000000..788f3370f --- /dev/null +++ b/app/scripts/lib/random-id.js @@ -0,0 +1,9 @@ +const MAX = Number.MAX_SAFE_INTEGER + +let idCounter = Math.round(Math.random() * MAX) +function createRandomId () { + idCounter = idCounter % MAX + return idCounter++ +} + +module.exports = createRandomId |