@rpgjs/physic
Version:
A deterministic 2D top-down physics library for RPG, sandbox and MMO games
20 lines (19 loc) • 549 B
JavaScript
function generateUUID() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === "x" ? r : r & 3 | 8;
return v.toString(16);
});
}
function generateDeterministicUUID(seed) {
let hash = seed;
hash = (hash << 5) - hash + seed;
hash = hash & hash;
const hex = Math.abs(hash).toString(16).padStart(8, "0");
return `00000000-0000-4000-8000-${hex.padStart(12, "0")}`;
}
export {
generateDeterministicUUID,
generateUUID
};
//# sourceMappingURL=index43.js.map