rendered paste body/* * RandNegGen.java * * Created on April 26, 2005, 12:16 PM */package aiycaptcha_plain;/** * * @author alphau */public class RandNegGen { private int translateX; /** Creates a new instance of RandNegGen */ public RandNegGen() { int k = 0; while ( k < 5) { double shearX = retDub(); if ( ( shearX >= 0.0 ) && ( shearX < 0.1 ) ) { translateX = -10; System.out.println("shearX is below 0.2: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < 0.2 ) ){ //notice that part isn't needed/redundancy translateX = -20; System.out.println("shearX is above 0.1: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < 0.3 ) ){ //notice that part isn't needed/redundancy translateX = -30; System.out.println("shearX is below 0.3: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < 0.4 ) ){ //notice that part isn't needed/redundancy translateX = -40; System.out.println("shearX is below 0.4: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < 0.5 ) ){ //notice that part isn't needed/redundancy translateX = -50; System.out.println("shearX is above 0.4 but less than 0.5: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < 0.6 ) ){ //notice that part isn't needed/redundancy translateX = -60; System.out.println("shearX is above 0.5 but less than 0.6: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < 0.7 ) ){ //notice that part isn't needed/redundancy translateX = -70; System.out.println("shearX is above 0.6 but less than 0.7: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < 0.8 ) ){ //notice that part isn't needed/redundancy translateX = -80; System.out.println("shearX is above 0.7 but less than 0.8: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < 0.9 ) ){ //notice that part isn't needed/redundancy translateX = -90; System.out.println("shearX is above 0.8 but less than 0.9: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < 1.0 ) ){ //notice that part isn't needed/redundancy translateX = -100; System.out.println("shearX is above 0.9 but less than 1.0: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } ////////////////////////////////////////////////////////////////////////////////negatives: else if ( ( shearX < 0.0 ) && ( shearX > (-0.1) ) ){ //notice that part isn't needed/redundancy translateX = -20; System.out.println("shearX is less than 0.0: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-0.1) ) ){ //notice that part isn't needed/redundancy translateX = -30; System.out.println("shearX is less than -0.1: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-0.2) ) ){ //notice that part isn't needed/redundancy translateX = -40; System.out.println("shearX is less than -0.2: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-0.3) ) ){ //notice that part isn't needed/redundancy translateX = -50; System.out.println("shearX is less than -0.3: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-0.4) ) ){ //notice that part isn't needed/redundancy translateX = -60; System.out.println("shearX is less than -0.4: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-0.5) ) ){ //notice that part isn't needed/redundancy translateX = -70; System.out.println("shearX is less than -0.5: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-0.6) ) ){ //notice that part isn't needed/redundancy translateX = -80; System.out.println("shearX is less than -0.6: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-0.7) ) ){ //notice that part isn't needed/redundancy translateX = -90; System.out.println("shearX is less than -0.7: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-0.8) ) ){ //notice that part isn't needed/redundancy translateX = -100; System.out.println("shearX is less than -0.8: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-0.9) ) ){ //notice that part isn't needed/redundancy translateX = -100; System.out.println("shearX is less than -0.9: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } else if ( /**( shearX >= 0.5 ) && */( shearX < (-1.0) ) ){ //notice that part isn't needed/redundancy translateX = -100; System.out.println("shearX is less than -1.0: " + shearX); System.out.println("and here is translateX: " + translateX); k++; } } //////////////////////////////////////////////////////////////////////// } public double retDub() { double shearX2 = Math.random() * 1.9 - 0.9; return shearX2; } public static void main(String[] args) { RandNegGen rng = new RandNegGen(); } }