S
Stefan Ram
I was just writing a small and simple program to calculate
a random number from the set {0,1}:
final int r = secureRandom.nextInt();
final int result =( r / 69313 )% 2;
Just for the heck of it, I added:
assert result >= 0 && result < 2;
As I wrote this, I thought: This assertion is completely
unnecessary, because it is obvious that the result of »% 2«
is always in the set {0,1}. So what am I doing here? Just
stating the obvious to needlessly enlarge the source code?
The next thing happening then, of course, was:
Exception in thread "main" java.lang.AssertionError
a random number from the set {0,1}:
final int r = secureRandom.nextInt();
final int result =( r / 69313 )% 2;
Just for the heck of it, I added:
assert result >= 0 && result < 2;
As I wrote this, I thought: This assertion is completely
unnecessary, because it is obvious that the result of »% 2«
is always in the set {0,1}. So what am I doing here? Just
stating the obvious to needlessly enlarge the source code?
The next thing happening then, of course, was:
Exception in thread "main" java.lang.AssertionError