same testdata assigned to multiple threads

Hi all,
I created one function in one library files which generates random ip address which i send in POST request for one page. Issue is when i executed script for 20 concurrent users, it assigns same IP address at time period (say 4-5 running users) and sent in POST requests, which results in failures. Can somebody helps me what i need to do to resolve this issue?

Thanks in advance,
Nidhish