pub fn next(&self) -> u32 {
        // M = 2^31-1
        const M: u32 = 2147483647;
        // A = 0b0100_0001_1010_0111
        const A: u64 = 16807;

        // We are computing
        //       seed = (seed * A) % M,    where M = 2^31-1
        //
        // seed must not be zero or M, or else all subsequent computed values
        // will be zero or M respectively. For all other values, seed will end
        // up cycling through every number in [1,M-1].
        let product: u64 = (self.seed.get() as u64) * A;

        // To avoid the 64-bit division, compute (product % M) using the fact:
        //       ((x << 31) % M) == x.
        self.seed.set(((product >> 31) as u32) + ((product as u32) & M));

        // The first reduction may overflow by 1 bit, so we may need to repeat.
        // mod == M is not possible; using > allows the faster sign-bit-based test.
        if self.seed.get() > M {
            self.seed.set(self.seed.get() - M);
        }

        self.seed.get()
    }
/// Return the next random number in this generator.
Return the next random number in this generator.
Return the next random number in this generator .
pub fn next(&self) -> u32 {
        // M = 2^31-1
        const M: u32 = 2147483647;
        // A = 0b0100_0001_1010_0111
        const A: u64 = 16807;
        // We are computing
        //       seed = (seed * A) % M,    where M = 2^31-1
        //
        // seed must not be zero or M, or else all subsequent computed values
        // will be zero or M respectively. For all other values, seed will end
        // up cycling through every number in [1,M-1].
        let product: u64 = (self.seed.get() as u64) * A;
        // To avoid the 64-bit division, compute (product % M) using the fact:
        //       ((x << 31) % M) == x.
        self.seed.set(((product >> 31) as u32) + ((product as u32) & M));
        // The first reduction may overflow by 1 bit, so we may need to repeat.
        // mod == M is not possible; using > allows the faster sign-bit-based test.
        if self.seed.get() > M {
            self.seed.set(self.seed.get() - M);
        }
        self.seed.get()
    }
pub fn next ( & self ) -> u32 { // M = 2^31-1 const M : u32 = 2147483647 ; // A = 0b0100_0001_1010_0111 const A : u64 = 16807 ; // We are computing //       seed = (seed * A) % M,    where M = 2^31-1 // // seed must not be zero or M, or else all subsequent computed values // will be zero or M respectively. For all other values, seed will end // up cycling through every number in [1,M-1]. let product : u64 = ( self . seed . get ( ) as u64 ) * A ; // To avoid the 64-bit division, compute (product % M) using the fact: //       ((x << 31) % M) == x. self . seed . set ( ( ( product >> 31 ) as u32 ) + ( ( product as u32 ) & M ) ) ; // The first reduction may overflow by 1 bit, so we may need to repeat. // mod == M is not possible; using > allows the faster sign-bit-based test. if self . seed . get ( ) > M { self . seed . set ( self . seed . get ( ) - M ) ; } self . seed . get ( ) }
Return the next random number in this generator.
Return the next random number in this generator .
&self
&self