public void seedUsingPcmAudio ( byte [ ] data ) { byte [ ] key = new byte [ 64 ] ; for ( int i = 0 ; i < key . length ; i ++ ) { int x = 0 ; //Pick 4 random bytes from the PCM audio data, from each of the bytes //take the two least significant bits and concatenate them to form //the i-th byte in the seed key for ( int j = 0 ; j < 4 ; j ++ ) { x = ( x << 2 ) | ( 3 & data [ RandomSource . getInt ( data . length ) ] ) ; } key [ i ] = ( byte ) x ; } seed ( key ) ; initialized = true ; }
Seed the random generator with 2 least significant bits of randomly picked bytes within the provided PCM audio data