import Long from 'long' ; export default class RandomIntGenerator { static getAttemptId ( ) { const sysTime = Long . fromNumber ( Date . now ( ) ) . shiftLeft ( 22 ) ; const randomBit = Long . fromNumber ( RandomIntGenerator . generate ( ) & 4194303 ) . and ( Long . MAX_VALUE ) ; return sysTime . or ( randomBit ) ; } static generate ( ) { return Math . floor ( Math . random ( ) * Math . floor ( Number . MAX_SAFE_INTEGER ) ) ; } }