Wrote impl of id generator from a given list.