added: #nextInt: - squeak compatibility
authorClaus Gittinger <cg@exept.de>
Mon, 12 Oct 2009 15:10:01 +0200
changeset 2309 9f2c39c721db
parent 2308 d8b410a4f38b
child 2310 c6f63285e4c8
added: #nextInt: - squeak compatibility
Random.st
--- a/Random.st	Mon Oct 12 14:52:26 2009 +0200
+++ b/Random.st	Mon Oct 12 15:10:01 2009 +0200
@@ -314,6 +314,16 @@
 
 !Random methodsFor:'Compatibility-Squeak'!
 
+nextInt:upperBound
+    "Answer a random integer in the interval [1, anInteger]."
+
+    ^ self nextIntegerBetween:1 and:upperBound
+
+    "
+     Random new nextInt:10
+    "
+!
+
 nextIntFrom:lowerBound to:upperBound
     "return a random integer in the given range"
 
@@ -598,9 +608,9 @@
 !Random class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.41 2009-10-04 20:07:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.42 2009-10-12 13:10:01 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.41 2009-10-04 20:07:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.42 2009-10-12 13:10:01 cg Exp $'
 ! !