changed trig() to pass correct index for parallel individual races