- Changed default random number generator to use RAND_bytes from openssl.

- Updated random testing code and fixed compilation



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4621 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-09-28 19:34:27 +00:00
parent febcfc9bd3
commit 5ae506c317
3 changed files with 35 additions and 4 deletions

View file

@ -1,5 +1,6 @@
RS_TOP_DIR = ../..
DHT_TOP_DIR = ../../../../libbitdht/src
##### Define any flags that are needed for this section #######
###############################################################

View file

@ -2,6 +2,7 @@
#include <fenv.h>
#endif
#include <iostream>
#include <iomanip>
#include <vector>
#include <stdlib.h>
#include <math.h>
@ -87,7 +88,7 @@ class myThread: public RsThread
{
// test that random numbers are regularly disposed
//
int N = 500 ;
int N = 5000 ;
int B = 8 ;
std::vector<int> buckets(B,0) ;
@ -133,6 +134,11 @@ int main(int argc, char **argv)
feenableexcept(FE_DIVBYZERO) ;
#endif
std::cerr << "Generating random 64 chars string (run that again to test that it's changing): " << RSRandom::random_alphaNumericString(64) << std::endl;
std::cerr << "Generating 10 random uint64_t:" << std::endl;
for(int i=0;i<10;++i)
std::cerr << std::hex << RSRandom::random_u64() << std::endl;
int nt = 10 ; // number of threads.
std::vector<myThread *> threads(nt,(myThread*)NULL) ;