summaryrefslogtreecommitdiffstats
path: root/src/libs/7zip/win/CPP/Common/Random.cpp
blob: 4bd3fcf935c4fa831341cf427a89363299efc2fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Common/Random.cpp

#include "StdAfx.h"

#include <stdlib.h>

#ifndef _WIN32
#include <time.h>
#endif

#include "Random.h"

void CRandom::Init(unsigned int seed) { srand(seed); }

void CRandom::Init()
{
  Init((unsigned int)
    #ifdef _WIN32
    GetTickCount()
    #else
    time(NULL)
    #endif
    );
}

int CRandom::Generate() const { return rand(); }