< prev index next >
src/java.base/share/classes/java/util/Random.java
Print this page
*** 74,83 ****
--- 74,84 ----
* @since 1.0
*/
public
class Random implements java.io.Serializable {
/** use serialVersionUID from JDK 1.1 for interoperability */
+ @java.io.Serial
static final long serialVersionUID = 3905348978240129619L;
/**
* The internal state associated with this pseudorandom number generator.
* (The specs for the methods in this class describe the ongoing
*** 1166,1185 ****
--- 1167,1188 ----
* @serialField nextNextGaussian double
* next Gaussian to be returned
* @serialField haveNextNextGaussian boolean
* nextNextGaussian is valid
*/
+ @java.io.Serial
private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("seed", Long.TYPE),
new ObjectStreamField("nextNextGaussian", Double.TYPE),
new ObjectStreamField("haveNextNextGaussian", Boolean.TYPE)
};
/**
* Reconstitute the {@code Random} instance from a stream (that is,
* deserialize it).
*/
+ @java.io.Serial
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = s.readFields();
*** 1195,1204 ****
--- 1198,1208 ----
}
/**
* Save the {@code Random} instance to a stream.
*/
+ @java.io.Serial
private synchronized void writeObject(ObjectOutputStream s)
throws IOException {
// set the values of the Serializable fields
ObjectOutputStream.PutField fields = s.putFields();
< prev index next >