Numerical methods for design of metamaterial photonic crystals and random metamaterials