private void assignRandomRegularMatrix(int n,SecureRandom sr){
  numRows=n;
  numColumns=n;
  length=(n + 31) >>> 5;
  matrix=new int[numRows][length];
  GF2Matrix lm=new GF2Matrix(n,Matrix.MATRIX_TYPE_RANDOM_LT,sr);
  GF2Matrix um=new GF2Matrix(n,Matrix.MATRIX_TYPE_RANDOM_UT,sr);
  GF2Matrix rm=(GF2Matrix)lm.rightMultiply(um);
  Permutation perm=new Permutation(n,sr);
  int[] p=perm.getVector();
  for (int i=0; i < n; i++) {
    System.arraycopy(rm.matrix[i],0,matrix[p[i]],0,length);
  }
}

private void assignRandomRegularMatrix ( int n , SecureRandom sr ) { numRows = n ; numColumns = n ; length = ( n + 31 ) > > > 5 ; matrix = new int [ numRows ] [ length ] ; GF2Matrix lm = new GF2Matrix ( n , Matrix . MATRIX_TYPE_RANDOM_LT , sr ) ; GF2Matrix um = new GF2Matrix ( n , Matrix . MATRIX_TYPE_RANDOM_UT , sr ) ; GF2Matrix rm = ( GF2Matrix ) lm . rightMultiply ( um ) ; Permutation perm = new Permutation ( n , sr ) ; int [ ] p = perm . getVector ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . arraycopy ( rm . matrix [ i ] , 0 , matrix [ p [ i ] ] , 0 , length ) ; } }
create an nxn random regular matrix .
