test.c File Reference
#include <QuEST.h>
#include <stdio.h>
#include <unistd.h>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 6 of file test.c.

6  {
7 
8  QuESTEnv env = createQuESTEnv();
9 
10  unsigned long int* keys;
11  int numKeys;
12  getQuESTSeeds(env, &keys, &numKeys);
13 
14  printf("seeds[%d] = {", numKeys);
15  for (int i=0; i<numKeys; i++)
16  printf("%lu, ", keys[i]);
17  printf("}\n");
18 
19  long unsigned int s1 = keys[0];
20 
21 
22  printf("sleeping...\n");
23  sleep(1);
24 
25  seedQuESTDefault(&env);
26  getQuESTSeeds(env, &keys, &numKeys);
27 
28  printf("seeds[%d] = {", numKeys);
29  for (int i=0; i<numKeys; i++)
30  printf("%lu, ", keys[i]);
31  printf("}\n");
32 
33 
34  printf("key[0] dif = %lu\n", keys[0] - s1);
35 
36 
37  printf("custom keys:\n");
38  unsigned long int mykeys[100];
39  for (int i=0; i<100; i++)
40  mykeys[i] = i;
41 
42  seedQuEST(&env, mykeys, 100);
43 
44 
45  getQuESTSeeds(env, &keys, &numKeys);
46 
47  printf("seeds[%d] = {", numKeys);
48  for (int i=0; i<numKeys; i++)
49  printf("%lu, ", keys[i]);
50  printf("}\n");
51 
52 
53  destroyQuESTEnv(env);
54  return 0;
55 }

References createQuESTEnv(), destroyQuESTEnv(), getQuESTSeeds(), seedQuEST(), and seedQuESTDefault().

void destroyQuESTEnv(QuESTEnv env)
Destroy the QuEST environment.
void seedQuESTDefault(QuESTEnv *env)
Seeds the random number generator with the (master node) current time and process ID.
Definition: QuEST.c:1614
void getQuESTSeeds(QuESTEnv env, unsigned long int **seeds, int *numSeeds)
Obtain the seeds presently used in random number generation.
Definition: QuEST.c:1622
Information about the environment the program is running in.
Definition: QuEST.h:362
void seedQuEST(QuESTEnv *env, unsigned long int *seedArray, int numSeeds)
Seeds the random number generator with a custom array of key(s), overriding the default keys.
QuESTEnv createQuESTEnv(void)
Create the QuEST execution environment.