Skip to content

Commit

Permalink
random/autotest: enabling testing for various distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaeddert committed Dec 3, 2023
1 parent aa73b47 commit a5a3261
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 1 addition & 2 deletions makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1077,8 +1077,7 @@ $(random_objects) : %.o : %.c $(include_headers)
# autotests
random_autotests := \
src/random/tests/scramble_autotest.c \

# src/random/tests/random_autotest.c
src/random/tests/random_autotest.c \


# benchmarks
Expand Down
14 changes: 11 additions & 3 deletions src/random/tests/random_autotest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007 - 2015 Joseph Gaeddert
* Copyright (c) 2007 - 2023 Joseph Gaeddert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -109,8 +109,16 @@ void autotest_randweibf()
m1 /= (float) N;
m2 = (m2 / (float)N) - m1*m1;

CONTEND_DELTA(m1, 1.2533f+gamma, tol);
CONTEND_DELTA(m2, 0.42920f, tol);
// compute expected moments (closed-form solution)
float t0 = liquid_gammaf(1. + 1./alpha);
float t1 = liquid_gammaf(1. + 2./alpha);
float m1_exp = beta * t0 + gamma;
float m2_exp = beta*beta*( t1 - t0*t0 );
//printf("m1: %12.8f (expected %12.8f)\n", m1, m1_exp);
//printf("m2: %12.8f (expected %12.8f)\n", m2, m2_exp);

CONTEND_DELTA(m1, m1_exp, tol);
CONTEND_DELTA(m2, m2_exp, tol);
}

// Rice-K
Expand Down

0 comments on commit a5a3261

Please sign in to comment.