summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-07-05 10:08:32 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-07-05 10:08:32 +0000
commit4d69f2d6eb7eb6aa0a3b4986ce8ddb9ee66c624a (patch)
tree9c5e71ac15dd50833cbf498d39c559c3154d8e94
parent4db294103175cc0789ac63168c7308b3542ee184 (diff)
downloadscala-4d69f2d6eb7eb6aa0a3b4986ce8ddb9ee66c624a.tar.gz
scala-4d69f2d6eb7eb6aa0a3b4986ce8ddb9ee66c624a.tar.bz2
scala-4d69f2d6eb7eb6aa0a3b4986ce8ddb9ee66c624a.zip
Fixes #3584. No review.
-rw-r--r--src/library/scala/util/Random.scala44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/library/scala/util/Random.scala b/src/library/scala/util/Random.scala
index 69cb4bb48d..53e721dcda 100644
--- a/src/library/scala/util/Random.scala
+++ b/src/library/scala/util/Random.scala
@@ -17,6 +17,8 @@ import collection.immutable.List
*
*/
class Random(val self: java.util.Random) {
+ import collection.mutable.ArrayBuffer
+ import collection.generic.CanBuildFrom
/** Creates a new random number generator using a single long seed. */
def this(seed: Long) = this(new java.util.Random(seed))
@@ -97,27 +99,6 @@ class Random(val self: java.util.Random) {
}
def setSeed(seed: Long) { self.setSeed(seed) }
-}
-
-/** The object <code>Random</code> offers a default implementation
- * of scala.util.Random and random-related convenience methods.
- *
- * @since 2.8
- */
-object Random extends Random {
- import collection.mutable.ArrayBuffer
- import collection.generic.CanBuildFrom
-
- /** Returns a Stream of pseudorandomly chosen alphanumeric characters,
- * equally chosen from A-Z, a-z, and 0-9.
- *
- * @since 2.8
- */
- def alphanumeric: Stream[Char] = {
- def isAlphaNum(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')
-
- Stream continually nextPrintableChar filter isAlphaNum
- }
/** Returns a new collection of the same type in a randomly chosen order.
*
@@ -140,4 +121,25 @@ object Random extends Random {
bf(xs) ++= buf result
}
+
+}
+
+/** The object <code>Random</code> offers a default implementation
+ * of scala.util.Random and random-related convenience methods.
+ *
+ * @since 2.8
+ */
+object Random extends Random {
+
+ /** Returns a Stream of pseudorandomly chosen alphanumeric characters,
+ * equally chosen from A-Z, a-z, and 0-9.
+ *
+ * @since 2.8
+ */
+ def alphanumeric: Stream[Char] = {
+ def isAlphaNum(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')
+
+ Stream continually nextPrintableChar filter isAlphaNum
+ }
+
}