/** * <p>Returns the next pseudorandom, uniformly distributed float value * between <code>0.0</code> and <code>1.0</code> from the Math.random() * sequence.</p> * * @return the random float */ public static float nextFloat() { return nextFloat(JVM_RANDOM); }
/** * <p>Returns the next pseudorandom, uniformly distributed float value * between <code>0.0</code> and <code>1.0</code> from the Math.random() * sequence.</p> * * @return the random float */ public static float nextFloat() { return nextFloat(JVM_RANDOM); }
/** * <p>Returns the next pseudorandom, uniformly distributed float value * between <code>0.0</code> and <code>1.0</code> from the Math.random() * sequence.</p> * * @return the random float */ public static float nextFloat() { return nextFloat(JVM_RANDOM); }
/** * <p>Returns the next pseudorandom, uniformly distributed float value * between <code>0.0</code> and <code>1.0</code> from the Math.random() * sequence.</p> * * @return the random float */ public static float nextFloat() { return nextFloat(JVM_RANDOM); }
/** * <p>Returns the next pseudorandom, uniformly distributed float value * between <code>0.0</code> and <code>1.0</code> from the Math.random() * sequence.</p> * * @return the random float */ public static float nextFloat() { return nextFloat(JVM_RANDOM); }
/** * <p>Returns the next pseudorandom, uniformly distributed float value * between <code>0.0</code> and <code>1.0</code> from the Math.random() * sequence.</p> * * @return the random float */ public static float nextFloat() { return nextFloat(JVM_RANDOM); }
@Override public float apply(float value) { return RandomUtils.nextFloat() - 0.5f; } @Override
@Override public Float random() { return RandomUtils.nextFloat(); }
public static Float randomFloat() { return RandomUtils.nextFloat(); }
@Override public float apply(float value) { return RandomUtils.nextFloat() - 0.5f; }
@Override public float apply(float value) { return RandomUtils.nextFloat() - 0.5f; }
public static float randomFloat0to1() { return RandomUtils.nextFloat(); }
/** * Build a random {@link Float}. For example * <p/> * <code> * Float aRandomHeight = RandomBuilder.aRandomFloat(); * </code> * * @return a random {@link Float}. */ public static Float aRandomFloat() { return Float.valueOf(nextFloat()); }
public static float randomFloat(float min, float max) { if (Float.isInfinite(max - min)) { throw new IllegalArgumentException("range of float is infinty"); } return min + RandomUtils.nextFloat() * (max - min); }
@Programmatic public float any() { return RandomUtils.nextFloat(fake.random); } }
public static float randomFloat(int min, int max) { return RandomUtils.nextFloat() + RandomUtils.nextInt(max - min); }
@Test public void happyPath() throws Exception { when(cachedDataService.getPlatformIdentForId(PLATFORM_ID)).thenReturn(platformIdent); long time = RandomUtils.nextLong(); when(data.getPlatformIdent()).thenReturn(PLATFORM_ID); when(data.getTimeStamp()).thenReturn(new Timestamp(time)); when(data.getCount()).thenReturn(5); when(data.getTotalCpuUsage()).thenReturn(RandomUtils.nextFloat()); when(data.getMinCpuUsage()).thenReturn(RandomUtils.nextFloat()); when(data.getMaxCpuUsage()).thenReturn(RandomUtils.nextFloat()); Collection<Builder> pointBuilderCol = builder.createBuilders(data); assertThat(pointBuilderCol.size(), is(1)); Builder pointBuilder = pointBuilderCol.iterator().next(); assertThat(getMeasurement(pointBuilder), is(Series.CpuInformation.NAME)); assertThat(getTime(pointBuilder), is(time)); assertThat(getPrecision(pointBuilder), is(TimeUnit.MILLISECONDS)); assertThat(getTags(pointBuilder), hasEntry(Series.TAG_AGENT_ID, String.valueOf(PLATFORM_ID))); assertThat(getTags(pointBuilder), hasEntry(Series.TAG_AGENT_NAME, String.valueOf(AGENT_NAME))); assertThat(getFields(pointBuilder), hasEntry(Series.CpuInformation.FIELD_AVG_CPU_UTIL, (Object) Double.valueOf(data.getTotalCpuUsage() / data.getCount()))); assertThat(getFields(pointBuilder), hasEntry(Series.CpuInformation.FIELD_MAX_CPU_UTIL, (Object) Double.valueOf(data.getMaxCpuUsage()))); assertThat(getFields(pointBuilder), hasEntry(Series.CpuInformation.FIELD_MIN_CPU_UTIL, (Object) Double.valueOf(data.getMinCpuUsage()))); }
param = RandomUtils.nextLong(); } else if (type == Float.class || type == Float.TYPE) { param = RandomUtils.nextFloat(); } else if (type == Double.class || type == Double.TYPE) { param = RandomUtils.nextDouble();
private void doWrite(BlockCompressedDataOutputStream outputStream) throws IOException { outputStream.writeFloat(RandomUtils.nextFloat()); outputStream.writeDouble(RandomUtils.nextDouble()); outputStream.writeLong(RandomUtils.nextLong()); outputStream.writeInt(RandomUtils.nextInt()); outputStream.writeShort(0); outputStream.writeBoolean(RandomUtils.nextBoolean()); outputStream.writeBytes("test"); outputStream.writeByte(RandomUtils.nextInt()); outputStream.writeChar(TEST_CHAR_ID); outputStream.writeChars("test"); outputStream.flush(); }