How to randomly pick two elements of an array of size 100?

There are many ways you could do this, but simplest would be to use a.shuffle(), then pick a[0] and a[1].

You could also do

int val1, val2;

std::randomize(val1,val2) with {unique {val1,val2}; val1 inside {a}; val2 inside {a};};