forked from darrenjw/djwhacks
-
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
Showing
4 changed files
with
56 additions
and
16 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
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
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,41 @@ | ||
-- random-tests.dx | ||
-- understanding and testing Dex random number generation | ||
|
||
import djwutils | ||
|
||
k = new_key 42 | ||
|
||
-- single draws | ||
|
||
rand k | ||
randn k | ||
bern 0.5 k | ||
poisson 5.0 k | ||
binom 50 0.5 k | ||
|
||
exponential 2.0 k | ||
gaussian 5.0 2.0 k | ||
|
||
g = gaussian 5.0 2.0 | ||
[k1, k2] = split_key k | ||
g k | ||
g k1 | ||
g k2 | ||
|
||
-- drawing vectors | ||
|
||
x: (Fin 10)=>Float = randn_vec k | ||
x | ||
|
||
rand_vec 10 randn k | ||
rand_vec 8 (poisson 5.0) k | ||
rand_vec 15 (binom 20 0.5) k | ||
rand_vec 15 (binom 20 0.5) k1 | ||
rand_vec 15 (binom 20 0.5) k2 | ||
|
||
|
||
|
||
|
||
-- eof | ||
|
||
|