Share via


Random Constructors

Definition

Overloads

Random()

Creates a new random number generator.

Random(Int64)

Creates a new random number generator using a single long seed.

Random(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Random()

Creates a new random number generator.

[Android.Runtime.Register(".ctor", "()V", "")]
public Random ();
Attributes

Remarks

Creates a new random number generator. This constructor sets the seed of the random number generator to a value very likely to be distinct from any other invocation of this constructor.

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

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

Random(Int64)

Creates a new random number generator using a single long seed.

[Android.Runtime.Register(".ctor", "(J)V", "")]
public Random (long seed);
[<Android.Runtime.Register(".ctor", "(J)V", "")>]
new Java.Util.Random : int64 -> Java.Util.Random

Parameters

seed
Int64

the initial seed

Attributes

Remarks

Creates a new random number generator using a single long seed. The seed is the initial value of the internal state of the pseudorandom number generator which is maintained by method #next.

The invocation new Random(seed) is equivalent to:

{@code
            Random rnd = new Random();
            rnd.setSeed(seed);}

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

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

Random(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected Random (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Java.Util.Random : nativeint * Android.Runtime.JniHandleOwnership -> Java.Util.Random

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

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