forked from djuber/SciSmalltalk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e20c89e
commit 05f5598
Showing
138 changed files
with
445 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "packageExtension" : ".pkg" } | ||
{ "packageExtension" : ".package" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"noMethodMetaData" : true, | ||
"separateMethodMetaAndSource" : false, | ||
"useCypressPropertiesFile" : true } |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
as yet unclassified | ||
generator: aRandomNumberGenerator | ||
rng := aRandomNumberGenerator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
as yet unclassified | ||
n: numberOfTrials | ||
n := numberOfTrials |
5 changes: 2 additions & 3 deletions
5
.../BinomialGenerator.class/instance/next.st → .../BinomialGenerator.class/instance/next.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
!BinomialGenerator methodsFor: 'as yet unclassified'! | ||
as yet unclassified | ||
next | ||
| x | | ||
x := 0. | ||
n timesRepeat: [ rng next <= p ifTrue: [ x := x + 1 ] ]. | ||
^ x! ! | ||
^ x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
as yet unclassified | ||
p: aProbability | ||
p := aProbability |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"category" : "Math-Random", | ||
"classinstvars" : [ | ||
], | ||
"classtraitcomposition" : "{}", | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
"n", | ||
"p", | ||
"rng" ], | ||
"name" : "BinomialGenerator", | ||
"pools" : [ | ||
], | ||
"super" : "NumberGenerator", | ||
"traitcomposition" : "{}", | ||
"type" : "normal" } |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"category" : "Math-Random-Tests", | ||
"classinstvars" : [ | ||
], | ||
"classtraitcomposition" : "{}", | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "BinomialGeneratorTest", | ||
"pools" : [ | ||
], | ||
"super" : "TestCase", | ||
"traitcomposition" : "{}", | ||
"type" : "normal" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A ConstantGenerator is not really a random number generator. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
constant: aConstant | ||
constant := aConstant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
next | ||
^ constant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"category" : "Math-Random", | ||
"classinstvars" : [ | ||
], | ||
"classtraitcomposition" : "{}", | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "SergeStinckwich 3/30/2010 15:31", | ||
"instvars" : [ | ||
"constant" ], | ||
"name" : "ConstantGenerator", | ||
"pools" : [ | ||
], | ||
"super" : "NumberGenerator", | ||
"traitcomposition" : "{}", | ||
"type" : "normal" } |
Empty file.
5 changes: 2 additions & 3 deletions
5
...antGeneratorGenerateAlwaysTheSameValue.st → ...antGeneratorGenerateAlwaysTheSameValue.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
|
||
!ConstantGeneratorTest methodsFor: 'as yet unclassified'! | ||
as yet unclassified | ||
testConstantGeneratorGenerateAlwaysTheSameValue | ||
| g numberOfTrials | | ||
g := ConstantGenerator new. | ||
g constant: 1. | ||
self assert: g next = g next. | ||
self assert: g next = g next! ! | ||
self assert: g next = g next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"category" : "Math-Random-Tests", | ||
"classinstvars" : [ | ||
], | ||
"classtraitcomposition" : "{}", | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "ConstantGeneratorTest", | ||
"pools" : [ | ||
], | ||
"super" : "TestCase", | ||
"traitcomposition" : "{}", | ||
"type" : "normal" } |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
as yet unclassified | ||
generator: aRandomNumberGenerator | ||
rng := aRandomNumberGenerator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
as yet unclassified | ||
initialize | ||
hasNextGaussian := false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
as yet unclassified | ||
mean: aMeanValue | ||
mean := aMeanValue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
as yet unclassified | ||
next | ||
^ self nextGaussianNormalized * standardDeviation + mean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Math.package/GaussianGenerator.class/instance/standardDeviation..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
as yet unclassified | ||
standardDeviation: aStandardDeviation | ||
standardDeviation := aStandardDeviation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"category" : "Math-Random", | ||
"classinstvars" : [ | ||
], | ||
"classtraitcomposition" : "{}", | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
"rng", | ||
"mean", | ||
"standardDeviation", | ||
"hasNextGaussian", | ||
"nextGaussian" ], | ||
"name" : "GaussianGenerator", | ||
"pools" : [ | ||
], | ||
"super" : "NumberGenerator", | ||
"traitcomposition" : "{}", | ||
"type" : "normal" } |
Empty file.
5 changes: 2 additions & 3 deletions
5
...tedMeans:andExpectedStandardDeviation:.st → ...tedMeans.andExpectedStandardDeviation..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
|
||
!GaussianGeneratorTest methodsFor: 'as yet unclassified'! | ||
as yet unclassified | ||
checkDistributionOf: aGenerator withExpectedMeans: e andExpectedStandardDeviation: sd | ||
| data m | | ||
data := Set new. | ||
10000 timesRepeat: [ data add: aGenerator next ]. | ||
m := 0. | ||
data do: [ :each | m := each + m ]. | ||
m := m / data size. | ||
self assert: e - m <= 0.2! ! | ||
self assert: e - m <= 0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"category" : "Math-Random-Tests", | ||
"classinstvars" : [ | ||
], | ||
"classtraitcomposition" : "{}", | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "GaussianGeneratorTest", | ||
"pools" : [ | ||
], | ||
"super" : "TestCase", | ||
"traitcomposition" : "{}", | ||
"type" : "normal" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This uses a quick and dirty Linear Congruential generator. | ||
|
||
LCRandom new next. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
initialize-release | ||
initialize | ||
" Private - Answer the receiver " |
5 changes: 2 additions & 3 deletions
5
...t/classes/LCRandom.class/instance/next.st → Math.package/LCRandom.class/instance/next.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
!LCRandom methodsFor: 'accessing'! | ||
accessing | ||
next | ||
"Private - Answer a pseudo-Random floating point number | ||
between 0 and 1. | ||
Uses a quick and dirty Linear congruential generator," | ||
^ self nextFloat! ! | ||
^ self nextFloat |
5 changes: 2 additions & 3 deletions
5
...sses/LCRandom.class/instance/nextFloat.st → ...kage/LCRandom.class/instance/nextFloat.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
|
||
!LCRandom methodsFor: 'accessing'! | ||
accessing | ||
nextFloat | ||
"Private - Answer a pseudo-Random floating point number between 0 and 1. | ||
Uses a quick and dirty Linear congruential generator," | ||
|
||
seed := self peekSeed. | ||
^ seed / 120050.0! ! | ||
^ seed / 120050.0 |
5 changes: 2 additions & 3 deletions
5
...t/classes/LCRandom.class/instance/peek.st → Math.package/LCRandom.class/instance/peek.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
!LCRandom methodsFor: 'accessing'! | ||
accessing | ||
peek | ||
"Private - Answer a pseudo-Random floating point number between 0 and 1. | ||
Uses a simple, but fast, Linear Congruential generator." | ||
|
||
^ self peekSeed / 120050.0! ! | ||
^ self peekSeed / 120050.0 |
5 changes: 2 additions & 3 deletions
5
...asses/LCRandom.class/instance/peekSeed.st → ...ckage/LCRandom.class/instance/peekSeed.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
!LCRandom methodsFor: 'accessing'! | ||
accessing | ||
peekSeed | ||
"Private - Answer the next Integer seed calculated | ||
using a quick and dirty Linear congruential generator." | ||
|
||
^ seed * 2311 + 25367 \\ 120050! ! | ||
^ seed * 2311 + 25367 \\ 120050 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
zork | ||
^42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"category" : "Math-Random", | ||
"classinstvars" : [ | ||
], | ||
"classtraitcomposition" : "{}", | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "hfm 3/23/2009 21:22", | ||
"instvars" : [ | ||
], | ||
"name" : "LCRandom", | ||
"pools" : [ | ||
], | ||
"super" : "RandomGenerator", | ||
"traitcomposition" : "{}", | ||
"type" : "normal" } |
Empty file.
5 changes: 5 additions & 0 deletions
5
Math.package/LCRandomTest.class/instance/testPeekAlwaysReplyTheSameValue.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
tests | ||
testPeekAlwaysReplyTheSameValue | ||
| g | | ||
g := LCRandom new. | ||
self assert: g peek = g peek |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"category" : "Math-Random-Tests", | ||
"classinstvars" : [ | ||
], | ||
"classtraitcomposition" : "{}", | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "LCRandomTest", | ||
"pools" : [ | ||
], | ||
"super" : "TestCase", | ||
"traitcomposition" : "{}", | ||
"type" : "normal" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This generator uses the Lehmer's Linear Congruential method. | ||
|
||
LehmerRandom new next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
initialize-release | ||
initialize | ||
" Private - Answer the receiver " |
5 changes: 2 additions & 3 deletions
5
...asses/LehmerRandom.class/instance/next.st → ...ckage/LehmerRandom.class/instance/next.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
!LehmerRandom methodsFor: 'accessing'! | ||
accessing | ||
next | ||
"Private - Answer a Random Float between 0 and 1. | ||
Uses Lehmer's linear congruential method." | ||
|
||
^ self nextFloat! ! | ||
^ self nextFloat |
5 changes: 2 additions & 3 deletions
5
.../LehmerRandom.class/instance/nextFloat.st → .../LehmerRandom.class/instance/nextFloat.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
!LehmerRandom methodsFor: 'accessing'! | ||
accessing | ||
nextFloat | ||
"Private - Answer a Random Float between 0 and 1. Uses Lehmer's linear congruential method." | ||
|
||
seed := self peekSeed. | ||
^ seed / SmallInteger maxVal asFloat! ! | ||
^ seed / SmallInteger maxVal asFloat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
accessing | ||
peek | ||
"Private - Answer a pseudo-Random floating point number between 0 and 1." | ||
|
||
^ self peekSeed / SmallInteger maxVal asFloat |
5 changes: 2 additions & 3 deletions
5
...s/LehmerRandom.class/instance/peekSeed.st → ...e/LehmerRandom.class/instance/peekSeed.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
!LehmerRandom methodsFor: 'accessing'! | ||
accessing | ||
peekSeed | ||
"Private - Answer the next Integer seed calculated using Lehmer's linear congruential | ||
method. The seed is in the range 0..16r3FFFFFFF." | ||
|
||
^ ( seed * 31415821 ) + 1 bitAnd: SmallInteger maxVal! ! | ||
^ ( seed * 31415821 ) + 1 bitAnd: SmallInteger maxVal |
Oops, something went wrong.