Add separate pseudorandom generator for testing inputs
[gfxprim.git] / include / core / GP_TestingRandom.h
blob9f897f8cdf9a74002e6ed486abba431b566d79aa
1 /*****************************************************************************
2 * This file is part of gfxprim library. *
3 * *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
8 * *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
18 * *
19 * Copyright (C) 2011 Tomas Gavenciak <gavento@ucw.cz> *
20 * *
21 *****************************************************************************/
24 * These routines use a pseudorandom generator with internal state.
25 * Use this only to provide tests with pseudo-random inputs.
26 * The seed is initialized with the test name, so the random numbers
27 * (and therefore inputs) are the same for a test, and do not depend
28 * on random() called in the tested routines or other tests.
31 #ifndef CORE_GP_TESTING_RANDOM_H
32 #define CORE_GP_TESTING_RANDOM_H
34 /*
35 * Return next random value from the testing random generator
37 long int GP_TestingRandom(void);
40 * Initialize the random generator to a seed computed from the given string
41 * and the given seed value. Needs to be called at least once.
43 * The string may be for example the name of the test, the seed the number of test iteration.
45 void GP_InitTestingRandom(const char *text, uint64_t seed);
47 #endif /* CORE_GP_TESTING_RANDOM_H */