1 |
|
/* |
2 |
< |
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. |
2 |
> |
* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. |
3 |
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
|
* |
5 |
|
* This code is free software; you can redistribute it and/or modify it |
26 |
|
package java.util; |
27 |
|
import java.io.*; |
28 |
|
import java.util.concurrent.atomic.AtomicLong; |
29 |
+ |
import java.util.stream.IntStream; |
30 |
+ |
import java.util.stream.Streams; |
31 |
+ |
|
32 |
|
import sun.misc.Unsafe; |
33 |
|
|
34 |
|
/** |
124 |
|
if (getClass() == Random.class) |
125 |
|
this.seed = new AtomicLong(initialScramble(seed)); |
126 |
|
else { |
127 |
< |
// subclass might have overridden setSeed |
127 |
> |
// subclass might have overriden setSeed |
128 |
|
this.seed = new AtomicLong(); |
129 |
|
setSeed(seed); |
130 |
|
} |
515 |
|
} |
516 |
|
} |
517 |
|
|
518 |
+ |
public IntStream ints() { |
519 |
+ |
return Streams.generateInt(this::nextInt); |
520 |
+ |
} |
521 |
+ |
|
522 |
|
/** |
523 |
|
* Serializable fields for Random. |
524 |
|
* |