UNPKG

@opendnd/genetica

Version:

This is a tool for using a simplified genetics system to generate inheritable traits for DnD characters.

20 lines (16 loc) 412 B
declare global { // tslint:disable-next-line interface Array<T> { pushUnique(element: T): void; sample(): T; } } // only push unique elements Array.prototype.pushUnique = function(element) { if (this.indexOf(element) === -1) { this.push(element); } }; // grab a random element Array.prototype.sample = function() { return this[Math.floor(Math.random() * this.length)]; }; export default {};