private static long nextLong(long bound) {
        // error checking and 2^x checking removed for simplicity.
        long bits, val;
        do {
            bits = (SECURE_RANDOM.nextLong() << 1) >>> 1;
            val = bits % bound;
        } while (bits - val + (bound - 1) < 0L);
        return val;
    }
https://www.php.net/manual/en/ref.csprng.php
exts/jphp-zend-ext/src/main/java/org/develnext/jphp/zend/ext/crypto/csprng/CSPRNGFunctions.java