UNPKG

@randomgeekdom/rollbard

Version:

Libraries and generators for fantasy/scifi worldbuilding

22 lines 768 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Randomizer = /** @class */ (function () { function Randomizer() { } Randomizer.prototype.GetRandomInt = function (max) { return Math.floor(Math.random() * Math.floor(max)); }; Randomizer.prototype.GetRandomBool = function (percent) { if (percent === void 0) { percent = 50; } return this.GetRandomInt(101) <= percent; }; Randomizer.prototype.GetRandomElement = function (array) { return array[this.GetRandomInt(array.length)]; }; Randomizer.Get = function () { return new Randomizer(); }; return Randomizer; }()); exports.default = Randomizer; //# sourceMappingURL=Randomizer.js.map