c[i_, j_] := If[OddQ[i + j] == True, Ti, Ni];
l1 = Flatten[
Table[Flatten[{i b[[1]] + j b[[2]], c[i, j]}, 1], {i, -3,
3}, {j, -3, 3}], 1]
(* {{3, 0, Ni}, {3, -1, Ti}, {3, -2, Ni}, {3, -3, Ti}, {3, -4,
Ni}, {3, -5, Ti}, {3, -6, Ni}, {2, 1, Ti}, {2, 0, Ni}, {2, -1,
Ti}, {2, -2, Ni}, {2, -3, Ti}, {2, -4, Ni}, {2, -5, Ti}, {1, 2,
Ni}, {1, 1, Ti}, {1, 0, Ni}, {1, -1, Ti}, {1, -2, Ni}, {1, -3,
Ti}, {1, -4, Ni}, {0, 3, Ti}, {0, 2, Ni}, {0, 1, Ti}, {0, 0,
Ni}, {0, -1, Ti}, {0, -2, Ni}, {0, -3, Ti}, {-1, 4, Ni}, {-1, 3,
Ti}, {-1, 2, Ni}, {-1, 1, Ti}, {-1, 0, Ni}, {-1, -1, Ti}, {-1, -2,
Ni}, {-2, 5, Ti}, {-2, 4, Ni}, {-2, 3, Ti}, {-2, 2, Ni}, {-2, 1,
Ti}, {-2, 0, Ni}, {-2, -1, Ti}, {-3, 6, Ni}, {-3, 5, Ti}, {-3, 4,
Ni}, {-3, 3, Ti}, {-3, 2, Ni}, {-3, 1, Ti}, {-3, 0, Ni}} *)
In the above code, I want to Randomly chose n number (say 5) elements from the list l1 which contain Ni as replace that Ni by O. How do I do it?