12-06-2013, 01:50 AM
I think you can make it regen-safe by calling math.randomseed() with a number as the argument that is calculated from the chunk X and Z coords - for example:
math.randomseed((a_ChunkX % 1234567) + (a_ChunkZ % 7654321) * 321); math.random();This should provide the same random values for the same chunk repeatedly. The extra random() call is there because the first random number returned is "not random enough" - see http://lua-users.org/wiki/MathLibraryTutorial 's math.random section.