UNPKG

@firefly-exchange/library-sui

Version:

Sui library housing helper methods, classes to interact with Bluefin protocol(s) deployed on Sui

22 lines (21 loc) 779 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRandomString = exports.generateSalt = exports.generateRandomInt = void 0; function generateRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); // The maximum is exclusive and the minimum is inclusive return Math.floor(Math.random() * (min - max) + min); } exports.generateRandomInt = generateRandomInt; function generateSalt() { return (Date.now() + generateRandomInt(0, 1000000) + generateRandomInt(0, 1000000) + generateRandomInt(0, 1000000)); } exports.generateSalt = generateSalt; function getRandomString(length) { return (Math.random() + 1).toString(36).substring(length + 1); } exports.getRandomString = getRandomString;