The generation of the Optical Orthogonal Code(OOC) with good performances is one of the key techniques for OCDMA communication.A modified method for the generation of(n
w
1
1) OCC(denoted by GA-OOC) with arbitrary code length and code weight by using the genetic algorithm is presented.A new code matrix is designed and new immigrants added in iteration.The simulation results indicate that the modified algorithm converges faster
the GA-OOC-based OCDMA system uses its hardware resources more effectively and has a lower BER as the code length and the code weight are independent from each other.