Patent ID: 8665925

Claim:
A method for generating a scrambling code, comprising: acquiring initial sequences X0, Y0; extending the initial sequences X0, Y0 for (└N/M┘+1) times, and obtaining extended sequences X*, Y*, wherein, the N is a positive integer, 0<M≦22, and “└ ┘” denotes rounded down; acquiring phase offset column vectors; and generating the scrambling code according to the extended sequences X*, Y* and the phase offset column vectors; wherein, the step of acquiring the initial sequences X0, Y0 comprises: according to the current user number, reading median values of sequences X, Y of a user by using an association relation between the user number and the median values of the sequences X, Y; judging whether the user in the current processing period produces the scrambling code for the first time, if yes, selecting the initial configured sequences X, Y as the initial sequences X0, Y0; and if not, selecting the read median values of the sequences X, Y as the initial sequences X0, Y0.