Random.st
changeset 1642 0abc34691f6c
parent 1212 96dde1bb098d
child 1841 fe14c3e736ef
equal deleted inserted replaced
1641:f708600ad7d9 1642:0abc34691f6c
   414     "
   414     "
   415 
   415 
   416     "Modified: 1.4.1997 / 22:42:53 / cg"
   416     "Modified: 1.4.1997 / 22:42:53 / cg"
   417 !
   417 !
   418 
   418 
       
   419 nextCharacters:count
       
   420     "get the next cnt printable characters.
       
   421      We answer characters in the ascii range (codepoints 32 - 127)"
       
   422 
       
   423     |res|
       
   424 
       
   425     res := String uninitializedNew:count.
       
   426 
       
   427     1 to:count do:[:i|
       
   428         self step.
       
   429         res at:i put:(Character value:(seed \\ 95 + 32)).
       
   430     ].
       
   431 
       
   432     ^ res
       
   433 
       
   434     "
       
   435       Random new nextCharacters:8
       
   436     "
       
   437 !
       
   438 
   419 nextInteger
   439 nextInteger
   420     "return the next integral random number,
   440     "return the next integral random number,
   421      in the range 0 .. 16r3FFFFFFF.
   441      in the range 0 .. 16r3FFFFFFF.
   422      From Sedgewick's 'Algorithms', based on Lehmer's method"
   442      From Sedgewick's 'Algorithms', based on Lehmer's method"
   423 
   443 
   548 ! !
   568 ! !
   549 
   569 
   550 !Random class methodsFor:'documentation'!
   570 !Random class methodsFor:'documentation'!
   551 
   571 
   552 version
   572 version
   553     ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.35 2003-05-15 15:46:13 stefan Exp $'
   573     ^ '$Header: /cvs/stx/stx/libbasic2/Random.st,v 1.36 2006-06-19 17:43:55 stefan Exp $'
   554 ! !
   574 ! !