how random is Math.random() in java across different jvms or different machines

Posted by user881480 on Stack Overflow See other posts from Stack Overflow or by user881480
Published on 2012-04-01T10:44:39Z Indexed on 2012/04/01 11:30 UTC
Read the original article Hit count: 280

Filed under:
|

I have a large distributed program across many different physical servers, each program spawns many threads, each thread use Math.random() in its operations to draw a piece from many common resource pools.

The goal is to utilize the pools evenly across all operations. Sometimes, it doesn't appear so random by looking at a snapshot on a resource pool to see which pieces it's getting at that instant (it might actually be, but it's hard to measure and find out for sure).

Is there something that's better than Math.random() and performs just as good (not much worse at least)?

© Stack Overflow or respective owner

Related posts about java

Related posts about random