Fast real valued random generator in java

后端 未结 6 1439
借酒劲吻你
借酒劲吻你 2020-12-31 12:51

java.util.Random.nextDouble() is slow for me and I need something really fast.

I did some google search and I\'ve found only integers based fast random generators.

6条回答
  •  伪装坚强ぢ
    2020-12-31 13:45

    Have you actually done benchmarking or profiling to show that nextDouble is the bottleneck? Have you looked at alternatives such as MersenneTwister or L'Ecuyer's streams library? I'd suggest trying those with benchmarking, but there's no such thing as a free lunch. Improvements in speed will probably come at a cost of quality, and vice-versa.

提交回复
热议问题