2 ms·
Still, if the point of using the Random object is being efficient, instantiating an object for just one nextBoolean() call is likely to be more inefficient than
by tspiteri 17y ago
Still, if the point of using the Random object is being efficient, instantiating an object for just one nextBoolean() call is likely to be more inefficient than just calling Math.random().
- city41 17y agoIt would depend on how Math.random() is implemented. It could be "return new Random().nextDouble();" I say that because if memory serves, Integer.parseInt(string s) is just "return new Integer(s).intValue();"