open62541 1.4.15
Open source implementation of OPC UA
Loading...
Searching...
No Matches
pcg_basic.h
Go to the documentation of this file.
1/*
2 * PCG Random Number Generation for C.
3 *
4 * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * For additional information about the PCG random number generation scheme,
19 * including its license and other licensing options, visit
20 *
21 * http://www.pcg-random.org
22 */
23
24#ifndef PCG_BASIC_H_
25#define PCG_BASIC_H_
26
27#if defined(UNDER_CE) || !defined(_MSC_VER) || _MSC_VER >= 1800
28# include <stdint.h>
29#else
30# include "ms_stdint.h"
31#endif
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37typedef struct pcg_state_setseq_64 {
38 uint64_t state; /* RNG state. All values are possible. */
39 uint64_t inc; /* Controls which RNG sequence (stream) is selected. Must
40 * *always* be odd. */
42
43#define PCG32_INITIALIZER { 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL }
44
45void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq);
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif /* PCG_BASIC_H_ */
struct pcg_state_setseq_64 pcg32_random_t
uint32_t pcg32_random_r(pcg32_random_t *rng)
void pcg32_srandom_r(pcg32_random_t *rng, uint64_t initial_state, uint64_t initseq)