1
0
Преглед на файлове

Small fixes to Random class comment.

Göran Krampe преди 13 години
родител
ревизия
7e638248ae
променени са 2 файла, в които са добавени 9 реда и са изтрити 7 реда
  1. 1 1
      js/Kernel-Objects.js
  2. 8 6
      st/Kernel-Objects.st

+ 1 - 1
js/Kernel-Objects.js

@@ -3472,7 +3472,7 @@ smalltalk.UndefinedObject.klass);
 
 
 smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
-smalltalk.Random.comment=unescape('Random%20is%20a%20random%20number%20generator%20and%20is%20implemented%20as%20a%20wrapper%20around%20javascript%20Math.random%28%29%20and%20is%20trivially%20used%20like%20this%3A%0A%0A%09Random%20new%20next%0A%0AThis%20will%20return%20a%20float%20x%20where%20x%20%3C%201%20and%20x%20%3E%200.%20If%20you%20want%20a%20random%20integer%20from%201%20to%2010%20you%20can%20use%20%23atRandom%0A%0A%0910%20atRandom%0A%0A...and%20if%20you%20want%20a%20random%20number%20in%20a%20specific%20interval%20this%20also%20works%3A%0A%0A%09%283%20to%3A%207%29%20atRandom%0A%0A...but%20be%20aware%20that%20%23to%3A%20does%20not%20create%20an%20Interval%20as%20in%20other%20Smalltalks%20but%20in%20fact%20an%20Array%20of%20numbers%2C%20so%20it%27s%20better%20to%20use%3A%0A%0A%095%20atRandom%20+%202%0A%0ASince%20%23atRandom%20is%20implemented%20in%20SequencableCollection%20you%20can%20easy%20pick%20an%20element%20at%20random%3A%0A%0A%09%23%28%27a%27%20%27b%27%20%27c%27%29%20atRandom%0A%0A...or%20perhaps%20a%20letter%20from%20a%20String%3A%0A%0A%09%27abc%27%20atRandom')
+smalltalk.Random.comment=unescape('%60Random%60%20is%20a%20random%20number%20generator%20and%20is%20implemented%20as%20a%20trivial%20wrapper%20around%20javascript%20%60Math.random%28%29%60%20and%20is%20used%20like%20this%3A%0A%0A%09Random%20new%20next%0A%0AThis%20will%20return%20a%20float%20x%20where%20x%20%3C%201%20and%20x%20%3E%200.%20If%20you%20want%20a%20random%20integer%20from%201%20to%2010%20you%20can%20use%20%60%23atRandom%60%0A%0A%0910%20atRandom%0A%0A...and%20if%20you%20want%20a%20random%20number%20in%20a%20specific%20interval%20this%20also%20works%3A%0A%0A%09%283%20to%3A%207%29%20atRandom%0A%0A...but%20be%20aware%20that%20%60%23to%3A%60%20does%20not%20create%20an%20Interval%20as%20in%20other%20Smalltalk%20implementations%20but%20in%20fact%20an%20%60Array%60%20of%20numbers%2C%20so%20it%27s%20better%20to%20use%3A%0A%0A%095%20atRandom%20+%202%0A%0ASince%20%60%23atRandom%60%20is%20implemented%20in%20%60SequencableCollection%60%20you%20can%20easy%20pick%20an%20element%20at%20random%3A%0A%0A%09%23%28%27a%27%20%27b%27%20%27c%27%29%20atRandom%0A%0A...or%20perhaps%20a%20letter%20from%20a%20%60String%60%3A%0A%0A%09%27abc%27%20atRandom%0A%0ASince%20Amber%20does%20not%20have%20Characters%20this%20will%20return%20a%20%60String%60%20of%20length%201%20like%20for%20example%20%60%27b%27%60.')
 smalltalk.addMethod(
 unescape('_next'),
 smalltalk.method({

+ 8 - 6
st/Kernel-Objects.st

@@ -1261,11 +1261,11 @@ Object subclass: #Random
 	instanceVariableNames: ''
 	category: 'Kernel-Objects'!
 !Random commentStamp!
-Random is a random number generator and is implemented as a wrapper around javascript Math.random() and is trivially used like this:
+`Random` is a random number generator and is implemented as a trivial wrapper around javascript `Math.random()` and is used like this:
 
 	Random new next
 
-This will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use #atRandom
+This will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`
 
 	10 atRandom
 
@@ -1273,17 +1273,19 @@ This will return a float x where x < 1 and x > 0. If you want a random integer f
 
 	(3 to: 7) atRandom
 
-...but be aware that #to: does not create an Interval as in other Smalltalks but in fact an Array of numbers, so it's better to use:
+...but be aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:
 
 	5 atRandom + 2
 
-Since #atRandom is implemented in SequencableCollection you can easy pick an element at random:
+Since `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:
 
 	#('a' 'b' 'c') atRandom
 
-...or perhaps a letter from a String:
+...or perhaps a letter from a `String`:
 
-	'abc' atRandom!
+	'abc' atRandom
+
+Since Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.!
 
 !Random methodsFor: 'accessing'!