// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.Arrays;
import java.util.Random;

public class Sim {
    private static final int N = 10000;
    private static final int REP = 100;
    public static void main(String[] args) {
        Actor[] a = new Actor[N];
        for(int i = 0; i < a.length; i++) a[i] = new Actor();
        long t1 = System.currentTimeMillis();
        for(int j = 0; j < REP; j++) {
            for(int i = 0; i < a.length; i++) {
                a[i].doSomeStuff();
            }
        }
        long t2 = System.currentTimeMillis();
        System.out.printf("%d ms per round", (t2 - t1) / REP);
    }
}

class Actor {
    private static final int W = 100;
    private static Random rng = new Random();
    public void doSomeStuff() {
        int[] a = new int[W];
        for(int i = 0; i < a.length; i++) a[i] = rng.nextInt();
        Arrays.sort(a);
    }
}
