what does this 0x7fffffff mean in this function and where can i learn more about it

0

want to understand this and learn to implement it myself what does 0x7FFFFFF mean where can i look to learn more

var secureRandom = function(count) {
    var rand = new Uint32Array(1)
    var skip = 0x7fffffff - 0x7fffffff % count
    var result

    if (((count - 1) & count) === 0) {
        window.crypto.getRandomValues(rand)
        return rand[0] & (count - 1)
    }
    do {
        window.crypto.getRandomValues(rand)
        result = rand[0] & 0x7fffffff
    } while (result >= skip)
    return result % count
}
javascript
asked on Stack Overflow May 23, 2019 by Gabriel Cirstea

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0