Skip to content

Instantly share code, notes, and snippets.

@ttldtor
Created September 12, 2019 06:04
Show Gist options
  • Save ttldtor/a22b5a72a6040cd7cecd49a4d65356d3 to your computer and use it in GitHub Desktop.
Save ttldtor/a22b5a72a6040cd7cecd49a4d65356d3 to your computer and use it in GitHub Desktop.
package ttldtor;
import java.util.concurrent.ThreadLocalRandom;
public class App {
static class A {
char c;
byte b;
int i;
long l;
String s;
A(char c, byte b, int i, long l, String s) {
this.c = c;
this.b = b;
this.i = i;
this.l = l;
this.s = s;
}
static A create(ThreadLocalRandom r) {
return new A((char) r.nextInt(), (byte) r.nextInt(), r.nextInt(), r.nextLong(),
String.valueOf(r.nextLong()));
}
}
public static void main(String[] args) throws InterruptedException {
ThreadLocalRandom r = ThreadLocalRandom.current();
while (true) {
for (int i = 0; i < 1000000; i++) {
A a = A.create(r);
}
Thread.sleep(r.nextInt(1, 300 + 1));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment