double ran = Math.signum(Math.random() - 0.5);
The variable ran will contain +1, -1 or sometimes 0.
10
solved What is the equivalent Java code of this MATLAB code? [closed]
double ran = Math.signum(Math.random() - 0.5);
The variable ran will contain +1, -1 or sometimes 0.
10
solved What is the equivalent Java code of this MATLAB code? [closed]