public Random getRandom ( ) { try { if ( threadRandom . get ( ) == null ) { Random t = ( Random ) randomClass . newInstance ( ) ; if ( t . getStatePointer ( ) != null ) { // TODO: attach this thing to deallocator // if it's stateless random - we just don't care then } threadRandom . set ( t ) ; return t ; } return threadRandom . get ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
This method returns Random implementation instance associated with calling thread