@godspeedsystems/core
Version:
> 4th Generation Declarative Microservice Framework
40 lines (39 loc) • 1.15 kB
JavaScript
/*
* You are allowed to study this software for learning and local * development purposes only. Any other use without explicit permission by Mindgrep, is prohibited.
* © 2022 Mindgrep Technologies Pvt Ltd
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
randomInt: function() {
return randomInt;
},
randomString: function() {
return randomString;
}
});
function randomString(length, characters) {
let result = '';
if (!characters) {
characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
}
let charactersLength = characters.length;
for(let i = 0; i < length; i++){
let c = characters.charAt(Math.floor(Math.random() * charactersLength));
if (!result && c == '0') {
continue;
}
result += c;
}
return result;
}
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}