Skip to content

Commit

Permalink
RandomのnextInt()をオーバーライドした…
Browse files Browse the repository at this point in the history
実機のRandom.nextInt()を信用できないので…

MIDP2.0のリファレンス通りの実装である

	public int nextInt() { return next(32); }

をしていなさそう…
next(int)が呼ばれていない気がする…

オブジェクト指向における継承を想定された設計が無視されているのでは…?
  • Loading branch information
neetsdkasu committed Mar 19, 2020
1 parent cab45c3 commit 994b7c9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion IDPWMemo_OAP/src/Cryptor.java
Expand Up @@ -20,7 +20,12 @@ public static byte[] getBytes(String s) throws UnsupportedEncodingException

static final Cryptor instance = new Cryptor();

private final MTRandom rand = new MTRandom();
private final MTRandom rand = new MTRandom() {
public int nextInt()
{
return next(32); // In OpenAppli-JavaMachine-java.util.Random, nextInt() method does not use next(int) method...
}
};
private final Checksum cs = new CRC32();

private Cryptor() {}
Expand Down

0 comments on commit 994b7c9

Please sign in to comment.