java - how to add times to loop everytime the method runs? -
i need have loop loops x times after x times stops , adds 5 times loop. how can , doing wrong?
private void loopmethod(anclass somename) { int g = 0; random o = new random(); int l = 50; int = l + g; //system.out.println(g); (int k = 0; k < a; k++) { int p = o.nextint(100); if(a == 100){ k = 101; } if (p == 1) { k = 101; } else { } } g = g + 5; }
start declaring g
global variable. can follows:
/* global declarations */ private random o = new random(); private int g = 0; /* logic */ private void loopmethod(anclass somename) { (int k = 0; k < 50 + g; k++) { if(g == 50 || o.nextint(100) == 1) k = 101; else /* */ } g += 5; }
this should fulfill needs.
Comments
Post a Comment