(float high)
| 5110 | * |
| 5111 | */ |
| 5112 | public final float random(float high) { |
| 5113 | // avoid an infinite loop when 0 or NaN are passed in |
| 5114 | if (high == 0 || high != high) { |
| 5115 | return 0; |
| 5116 | } |
| 5117 | |
| 5118 | if (internalRandom == null) { |
| 5119 | internalRandom = new Random(); |
| 5120 | } |
| 5121 | |
| 5122 | // for some reason (rounding error?) Math.random() * 3 |
| 5123 | // can sometimes return '3' (once in ~30 million tries) |
| 5124 | // so a check was added to avoid the inclusion of 'howbig' |
| 5125 | float value = 0; |
| 5126 | do { |
| 5127 | value = internalRandom.nextFloat() * high; |
| 5128 | } while (value == high); |
| 5129 | return value; |
| 5130 | } |
| 5131 | |
| 5132 | /** |
| 5133 | * ( begin auto-generated from randomGaussian.xml ) |
no outgoing calls
no test coverage detected