Partager via


IRandomGenerator.NextBoolean Method

Definition

Returns a pseudorandomly chosen boolean value.

[Android.Runtime.Register("nextBoolean", "()Z", "GetNextBooleanHandler:Java.Util.RandomGenerators.IRandomGenerator, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=35)]
public virtual bool NextBoolean ();
[<Android.Runtime.Register("nextBoolean", "()Z", "GetNextBooleanHandler:Java.Util.RandomGenerators.IRandomGenerator, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=35)>]
abstract member NextBoolean : unit -> bool
override this.NextBoolean : unit -> bool

Returns

a pseudorandomly chosen boolean value

Attributes

Remarks

Returns a pseudorandomly chosen boolean value.

The default implementation tests the high-order bit (sign bit) of a value produced by RandomGenerator#nextInt() nextInt(), on the grounds that some algorithms for pseudorandom number generation produce values whose high-order bits have better statistical quality than the low-order bits.

Java documentation for java.util.random.RandomGenerator.nextBoolean().

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