Skip to content

Commit

Permalink
replace 32bit mersenne twister with pcg
Browse files Browse the repository at this point in the history
and added bounds argument for rand and num rand.
See GH #99
  • Loading branch information
Reini Urban committed Nov 22, 2015
1 parent f7c451e commit 41e3aa4
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 190 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ v0.4
* Fix installation from source without git
* Fixed various SEGVs and minor errors and security issues.
* Fixed cmp for string (Peter Arthur)
* Replaced 32bit mersenne twister with pcg.
* Added bounds argument for rand and num rand.

v0.3 Sat Oct 17 10:42:49 CEST 2015 rurban v0.3-g7963cbc-1264

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
examples release install grammar doxygen website testable
.NOTPARALLEL: test

SRC = core/asm.c core/ast.c core/compile.c core/contrib.c core/gc.c core/internal.c core/lick.c core/mt19937ar.c core/number.c core/objmodel.c core/primitive.c core/string.c core/syntax.c core/table.c core/vm.c
SRC = core/asm.c core/ast.c core/compile.c core/contrib.c core/gc.c core/internal.c core/lick.c core/pcg.c core/number.c core/objmodel.c core/primitive.c core/string.c core/syntax.c core/table.c core/vm.c
PLIBS = readline buffile aio database
PLIBS_SRC = lib/aio.c lib/buffile.c lib/database.c lib/readline/readline.c lib/readline/linenoise.c
GREGCFLAGS = -O3 -DNDEBUG
Expand Down Expand Up @@ -202,7 +202,7 @@ $(foreach o,${OBJS},core/internal.${o} ): core/internal.c core/potion.h core/con
$(foreach o,${OBJS},core/lick.${o} ): core/lick.c core/potion.h core/config.h core/internal.h
$(foreach o,${OBJS},core/load.${o} ): core/load.c core/potion.h core/config.h core/internal.h \
core/table.h core/khash.h
$(foreach o,${OBJS},core/mt19937ar.${o} ): core/mt19937ar.c core/potion.h core/config.h
$(foreach o,${OBJS},core/pcg.${o} ): core/pcg.c core/potion.h core/config.h
$(foreach o,${OBJS},core/number.${o} ): core/number.c core/potion.h core/config.h core/internal.h
$(foreach o,${OBJS},core/objmodel.${o} ): core/objmodel.c core/potion.h core/config.h core/internal.h \
core/khash.h core/table.h core/asm.h
Expand Down
184 changes: 0 additions & 184 deletions core/mt19937ar.c

This file was deleted.

4 changes: 2 additions & 2 deletions core/number.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ void potion_num_init(Potion *P) {
potion_method(dbl_vt, "/", potion_dbl_div, "value=D");
potion_method(dbl_vt, "abs", potion_dbl_abs, 0);
potion_method(dbl_vt, "cmp", potion_dbl_cmp, "value=D");
//potion_method(dbl_vt, "rand", potion_dbl_rand, 0);
//potion_method(dbl_vt, "rand", potion_dbl_rand, "|bound=D");
// optimized integer-only methods, for both operands
potion_method(int_vt, "+", potion_int_add, "value=I");
potion_method(int_vt, "-", potion_int_sub, "value=I");
Expand All @@ -482,7 +482,7 @@ void potion_num_init(Potion *P) {
potion_method(int_vt, "chr", potion_int_chr, 0);
potion_method(int_vt, "abs", potion_int_abs, 0);
potion_method(int_vt, "cmp", potion_int_cmp, "value=I");
//potion_method(int_vt, "rand", potion_int_rand, 0);
//potion_method(int_vt, "rand", potion_int_rand, "|bound=I");
potion_method(num_vt, "step", potion_int_step, "end=N,step=N,block=&");
potion_method(num_vt, "times", potion_int_times, "block=&");
potion_method(num_vt, "to", potion_int_to, "end=N,block=&");
Expand Down
2 changes: 1 addition & 1 deletion core/objmodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ void potion_lobby_init(Potion *P) {
potion_method(P->lobby, "kind", potion_lobby_kind, 0);
potion_method(P->lobby, "isa?", potion_lobby_isa, "value=o");
potion_method(P->lobby, "srand", potion_srand, "seed=N");
potion_method(P->lobby, "rand", potion_rand, 0);
potion_method(P->lobby, "rand", potion_rand, "|bound=N");
potion_method(P->lobby, "self", potion_lobby_self, 0);
potion_method(P->lobby, "string", potion_lobby_string, 0);
potion_method(P->lobby, "can", potion_lobby_can, "method=S");
Expand Down
Loading

0 comments on commit 41e3aa4

Please sign in to comment.