While this is an interesting problem and I liked the answers, especially hdb's, it seems disconnected from your actual need. Predictable, randomized integers for use in unit tests, never changing. It would take one pass with int(rand(...)) for 1 .. $whatever to build a fixture and be done with it; and not risk introducing complications or dependencies on new code. The more code a test has the worse I think.