From 4ce404bc32e46b7cdcb834f0077cda2219988e44 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 20 Mar 2024 03:38:00 -0300 Subject: tests/rand.mjs: Add MersenneTwister random number generator The `tests/rand.c` is also added: a simplified adaptation of the original algorithm implementation in C. A 10k numbers test case shows that the JavaScript version behaves the same that the C one does. --- Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1870773..6ea0735 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DESTDIR = .SUFFIXES: -.SUFFIXES: .in +.SUFFIXES: .in .c .bin .in: sed \ @@ -34,6 +34,9 @@ DESTDIR = < $< > $@ if [ -x $< ]; then chmod +x $@; fi +.c.bin: + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) + all: @@ -53,6 +56,8 @@ installable = \ derived-assets = \ $(manpages) \ + tests/rand.bin \ + tests/bigger-rand-output.txt \ side-assets = \ tests/hero-*.pipe \ @@ -68,8 +73,13 @@ side-assets = \ ## and installation. all: $(derived-assets) +tests/bigger-rand-output.txt: tests/rand.bin + printf '[\n\t%s\n]\n' \ + "`./$? | tr '\n' ',' | sed -e 's|,$$||' -e 's|,|,\n\t|g'`" > $@ + -$(manpages): Makefile deps.mk +tests/rand.bin $(manpages): Makefile deps.mk +tests/js/rand.mjs-check: tests/bigger-rand-output.txt -- cgit v1.2.3