Help! Noise problem!

In OpenGL Shading Language 2nd Edition Chapter 15. “Noise” page 396. The author mentioned that he made some small change to Perlin Noise code(SetNoiseFrequency function).
I can’t figure out why this method can keep the continuity on the texture edge. I implement as follow, and it really works.(But why?)He initializes the P and G table in each octaves…so each octaves are independent(P G table are different).
Please help me to clarify my concept. Thanks