Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_RNG.h
Go to the documentation of this file.
1/*
2 * Author: Crownstone Team
3 * Copyright: Crownstone (https://crownstone.rocks)
4 * Date: 5 Jan., 2015
5 * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
6 */
7#pragma once
8
9#include <cstdint>
10
14class RNG {
15public:
16 // Use static variant of singleton, no dynamic memory allocation
17 static RNG& getInstance() {
18 static RNG instance;
19 return instance;
20 }
21
22 static void fillBuffer(uint8_t* buffer, uint8_t length);
23
24 uint32_t getRandom32();
25 uint16_t getRandom16();
26 uint8_t getRandom8();
27
28private:
29 uint8_t _randomBytes[4];
30
31 // Constructor
32 RNG();
33
34 // This class is singleton, deny implementation
35 RNG(RNG const&);
36
37 // This class is singleton, deny implementation
38 void operator=(RNG const&);
39};
Random number generator using softdevice called peripheral.
Definition: cs_RNG.h:14
void operator=(RNG const &)
static void fillBuffer(uint8_t *buffer, uint8_t length)
uint8_t getRandom8()
RNG(RNG const &)
uint32_t getRandom32()
static RNG & getInstance()
Definition: cs_RNG.h:17
uint16_t getRandom16()
uint8_t _randomBytes[4]
Definition: cs_RNG.h:29