ThreadLocalRandom.NextFloat Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| NextFloat(Single) |
Returns a pseudorandom |
| NextFloat(Single, Single) |
Returns a pseudorandom |
NextFloat(Single)
Returns a pseudorandom float value from zero (inclusive) to bound (exclusive).
[Android.Runtime.Register("nextFloat", "(F)F", "GetNextFloat_FHandler", ApiSince=35)]
public virtual float NextFloat(float bound);
[<Android.Runtime.Register("nextFloat", "(F)F", "GetNextFloat_FHandler", ApiSince=35)>]
override this.NextFloat : single -> single
Parameters
- bound
- Single
The exclusive upper bound for the returned value; must be positive and finite.
Returns
A pseudorandom float value from zero (inclusive) to bound (exclusive).
- Attributes
Exceptions
If bound is not both positive and finite.
Remarks
Validates that bound is positive and finite, then scales a generated value so that the result is from zero (inclusive) to bound (exclusive).
Java documentation for java.util.concurrent.ThreadLocalRandom.nextFloat(float).
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
NextFloat(Single, Single)
Returns a pseudorandom float value from origin (inclusive) to bound (exclusive).
[Android.Runtime.Register("nextFloat", "(FF)F", "GetNextFloat_FFHandler", ApiSince=35)]
public virtual float NextFloat(float origin, float bound);
[<Android.Runtime.Register("nextFloat", "(FF)F", "GetNextFloat_FFHandler", ApiSince=35)>]
override this.NextFloat : single * single -> single
Parameters
- origin
- Single
The inclusive lower bound for the returned value.
- bound
- Single
The exclusive upper bound for the returned value.
Returns
A pseudorandom float value from origin (inclusive) to bound (exclusive).
- Attributes
Exceptions
If origin or bound is not finite, their difference is not finite, or origin is greater than or equal to bound.
Remarks
Validates that both endpoints and the difference between them are finite, and that origin is less than bound, then scales and translates a generated value into that range.
Java documentation for java.util.concurrent.ThreadLocalRandom.nextFloat(float, float).
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.