Partager via


SecureRandom.SetSeed(Byte[]) Method

Definition

Reseeds this random object with the given seed.

[Android.Runtime.Register("setSeed", "([B)V", "GetSetSeed_arrayBHandler")]
public virtual void SetSeed (byte[]? seed);
[<Android.Runtime.Register("setSeed", "([B)V", "GetSetSeed_arrayBHandler")>]
override this.SetSeed : byte[] -> unit

Parameters

seed
Byte[]

the seed.

Attributes

Remarks

Reseeds this random object with the given seed. The seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.

A PRNG SecureRandom will not seed itself automatically if setSeed is called before any nextBytes or reseed calls. The caller should make sure that the seed argument contains enough entropy for the security of this SecureRandom.

Java documentation for java.security.SecureRandom.setSeed(byte[]).

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