Skip to content

Instantly share code, notes, and snippets.

@teruteru128
Created September 5, 2016 16:34
Show Gist options
  • Save teruteru128/48f5b292a19dbbd6a23815e58202ebd8 to your computer and use it in GitHub Desktop.
Save teruteru128/48f5b292a19dbbd6a23815e58202ebd8 to your computer and use it in GitHub Desktop.
JavaにおけるSecureRandomの一つの妥協点 ref: http://qiita.com/teruteru128/items/a0c4a031e708af788591
import java.security.SecureRandom;
public class Main {
public static void main(String[] args){
int seedSize = 16;
SecureRandom strong = SecureRandom.getInstanceStrong();
SecureRandom using = new SecureRandom(strong.generateSeed(seedSize));
/* 以降usingを乱数生成器として使用する */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment