mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-16 17:13:58 -05:00
removed unused tempering in random number generator, added comments and license text
This commit is contained in:
parent
6cf2090149
commit
858dcfc14c
2 changed files with 51 additions and 29 deletions
|
|
@ -1,36 +1,31 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2010 Cyril Soler <csoler@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* libretroshare/src/util: rsrandom.h *
|
||||
* *
|
||||
* libretroshare: retroshare core library *
|
||||
* *
|
||||
* Copyright (C) 2010 Cyril Soler <csoler@users.sourceforge.net> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
// RSRandom contains a random number generator that is
|
||||
// - thread safe
|
||||
// - system independant
|
||||
// - fast
|
||||
// - NOT CRYPTOGRAPHICALLY SAFE
|
||||
// - DO NOT USE FOR ANYTHING REQUIRING STRONG RANDOMNESS
|
||||
//
|
||||
// The implementation is adapted from the Mersenne Twister page of Wikipedia.
|
||||
//
|
||||
// http://en.wikipedia.org/wiki/Mersenne_twister
|
||||
// - CRYPTOGRAPHICALLY SAFE, because it is based on openssl random number generator
|
||||
|
||||
#include <vector>
|
||||
#include <util/rsthreads.h>
|
||||
|
|
@ -40,8 +35,8 @@ class RSRandom
|
|||
public:
|
||||
static uint32_t random_u32() ;
|
||||
static uint64_t random_u64() ;
|
||||
static float random_f32() ;
|
||||
static double random_f64() ;
|
||||
static float random_f32() ;
|
||||
static double random_f64() ;
|
||||
|
||||
static bool seed(uint32_t s) ;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue