OpENer - Open Source EtherNet/IP(TM) I/O Target Stack  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
random.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2017, Rockwell Automation, Inc.
3  * All rights reserved.
4  *
5  ******************************************************************************/
6 
7 #include "random.h"
8 
9 #include <stdlib.h>
10 
12  GetNextUInt32 get_next_uint32) {
13  Random *random = malloc( sizeof(Random) );
14  *random =
15  (Random ) { .set_seed = set_seed, .get_next_uint32 = get_next_uint32 };
16  return random;
17 }
18 
19 void RandomDelete(Random **random) {
20  free(*random);
21  *random = NULL;
22 }
Definition: random.h:15
SetSeed set_seed
Definition: random.h:17
uint32_t(* GetNextUInt32)(void)
Definition: random.h:13
Random * RandomNew(SetSeed set_seed, GetNextUInt32 get_next_uint32)
Definition: random.c:11
void RandomDelete(Random **random)
Definition: random.c:19
void(* SetSeed)(uint32_t seed)
Definition: random.h:12