Merge pull request #110 from tesselode/fixes
[wdl/wdl-ol.git] / WDL / rng.h
blob85fb21cf31984f43bf1a7bef0268250b86e25753
1 /*
2 WDL - rng.h
3 Copyright (C) 2005 and later, Cockos Incorporated
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
25 This header provides the interface to a decent random number generator,
26 that internally uses a 256-bit state, and SHA-1 to iterate. We wouldn't consider
27 this RNG to be cryptographically secure, but it may be decent.
31 #ifndef _WDL_RNG_H_
32 #define _WDL_RNG_H_
35 void WDL_RNG_addentropy(void *buf, int buflen); // add entropy to the RNG
37 int WDL_RNG_int32(); // get a random integer
38 void WDL_RNG_bytes(void *buf, int buflen); // get a random string of bytes
41 #endif