fill out the CarSales functions

This commit is contained in:
David Renshaw 2014-06-14 20:26:24 -04:00
parent c875e80fc7
commit 68a07c63c1
2 changed files with 15 additions and 1 deletions

View file

@ -10,10 +10,20 @@ public class Common {
this.state = 1013904223; this.state = 1013904223;
} }
public int next_int() { public int nextInt() {
this.state = this.a * this.state + c; this.state = this.a * this.state + c;
return this.state; return this.state;
} }
public int nextLessThan(int range) {
// sign?
return this.nextInt() % range;
}
public double nextDouble(double range) {
// XXX sign?
return (double) this.nextInt() * range / (double)(0xffffffffL);
}
} }
} }

View file

@ -34,6 +34,10 @@ public final class StructList {
this.factory = factory; this.factory = factory;
} }
public int size() {
return this.builder.size();
}
public final T get(int index) { public final T get(int index) {
return this.factory.fromStructBuilder(this.builder.getStructElement(index)); return this.factory.fromStructBuilder(this.builder.getStructElement(index));
} }