Your random number generator is using the current time in milliseconds as your
seed value.
If the seed value is always the same, the output will always be the same. So if
all your pages are generated within 1 millisecond (or within whatever resolution
the system's timer is via that function, which could easily be > 1 millisecond),
then they will all have the same collection of points.
By throwing in a 10 millisecond sleep, you're forcing the timer to be different
for each page. If you don't want to wait, throw in a variable that you change
each pass. Your for-loop counter works great:
Random random = new Random(i + System.currentTimeMillis());
Or you could use the param-less constructor for Random:
public Random() { this(++seedUniquifier + System.nanoTime()); }
The latter would probably be Just Fine.
Notes:
1) This actually had nothing to do with iText, but whatever.
2) Some game programs use "randomly generate stuff using the same seed to
generate the same stuff" to populate huge worlds/universes/whatever with
remarkably little data storage. Fractal Universe. "Elite" for various old
computer systems (Apple ][ in my case) used the technique. This also has
nothing to do with iText, but Interesting None The Less.
--Mark Storer
Senior Software Engineer
Cardiff.com
Blah blah blah.
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/