Share via


Random.NextFloat Method

Definition

Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

[Android.Runtime.Register("nextFloat", "()F", "GetNextFloatHandler")]
public virtual float NextFloat ();
[<Android.Runtime.Register("nextFloat", "()F", "GetNextFloatHandler")>]
abstract member NextFloat : unit -> single
override this.NextFloat : unit -> single

Returns

the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence

Implements

Attributes

Remarks

Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

The general contract of nextFloat is that one float value, chosen (approximately) uniformly from the range 0.0f (inclusive) to 1.0f (exclusive), is pseudorandomly generated and returned. All 2<sup>24</sup> possible float values of the form m&nbsp;x&nbsp;2<sup>-24</sup>, where m is a positive integer less than 2<sup>24</sup>, are produced with (approximately) equal probability.

Java documentation for java.util.Random.nextFloat().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to