import { Arcfour , prng_newstate , rng_psize } from "./prng4" ; let rng_state ; let rng_pool = null ; let rng_pptr ; if ( rng_pool == null ) { rng_pool = [ ] ; rng_pptr = 0 ; let t ; var count = 0 ; const onMouseMoveListener = function ( ev ) { count = count || 0 ; if ( count >= 256 || rng_pptr >= rng_psize ) { return ; } try { const mouseCoordinates = ev . x + ev . y ; rng_pool [ rng_pptr ++ ] = mouseCoordinates & 255 ; count += 1 ; } catch ( e ) { } } ; } function rng_get_byte ( ) { if ( rng_state == null ) { rng_state = prng_newstate ( ) ; while ( rng_pptr < rng_psize ) { const random = Math . floor ( 65536 * Math . random ( ) ) ; rng_pool [ rng_pptr ++ ] = random & 255 ; } rng_state . init ( rng_pool ) ; for ( rng_pptr = 0 ; rng_pptr < rng_pool . length ; ++ rng_pptr ) { rng_pool [ rng_pptr ] = 0 ; } rng_pptr = 0 ; } return rng_state . next ( ) ; } export class SecureRandom { public nextBytes ( ba ) { for ( let i = 0 ; i < ba . length ; ++ i ) { ba [ i ] = rng_get_byte ( ) ; } } }