(float high)
| 4688 | * |
| 4689 | */ |
| 4690 | public final float random(float high) { |
| 4691 | // avoid an infinite loop when 0 or NaN are passed in |
| 4692 | if (high == 0 || high != high) { |
| 4693 | return 0; |
| 4694 | } |
| 4695 | |
| 4696 | if (internalRandom == null) { |
| 4697 | internalRandom = new Random(); |
| 4698 | } |
| 4699 | |
| 4700 | // for some reason (rounding error?) Math.random() * 3 |
| 4701 | // can sometimes return '3' (once in ~30 million tries) |
| 4702 | // so a check was added to avoid the inclusion of 'howbig' |
| 4703 | float value; |
| 4704 | do { |
| 4705 | value = internalRandom.nextFloat() * high; |
| 4706 | } while (value == high); |
| 4707 | return value; |
| 4708 | } |
| 4709 | |
| 4710 | /** |
| 4711 | * |
no outgoing calls
no test coverage detected