import java.security.*; public class SR { public static void main(String[] args) { try{ SecureRandom csprng = SecureRandom.getInstance("SHA1PRNG"); boolean randBool = csprng.nextBoolean(); // 1ºñÆ® ³­¼ö »ý¼º int randInt = csprng.nextInt(); // Á¤¼ö ³­¼ö »ý¼º int randInt1 = csprng.nextInt(10); // ÁÖ¾îÁø Á¤¼ö ÀÌÇÏÀÇ ³­¼ö »ý¼º float randFloat = csprng.nextFloat(); // ½Ç¼ö ³­¼ö »ý¼º byte[] randBytes = new byte[10]; // ÇÊ¿ä·Î ÇÏ´Â ¹ÙÀÌÆ® ¼ö¸¸Å­ ³­¼ö »ý¼º csprng.nextBytes(randBytes); System.out.println("\n SecureRandom Ŭ·¡½º¸¦ ÀÌ¿ëÇÑ ³­¼ö »ý¼º "); System.out.print("\n 1ºñÆ® ³­¼ö »ý¼º : "+randBool ); System.out.print("\n Á¤¼ö ³­¼ö »ý¼º : "+randInt ); System.out.print("\n 10 ÀÌÇÏ Á¤¼ö ³­¼ö »ý¼º : "+randInt1 ); System.out.print("\n Á¤¼ö ³­¼ö »ý¼º : "+randFloat ); System.out.print("\n 10 ¹ÙÀÌÆ® ³­¼ö »ý¼º : "); for(byte b: randBytes) System.out.printf("%02X ", b); } catch(NoSuchAlgorithmException e){ e.printStackTrace(); } } }