Not Logged In
|
Login
|
Register
Home
|
News
|
Projects
|
Releases
Bugs
|
RFE
|
Repositories
|
Help
projects
/
xestiacalendar
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
macOS: Implemented macOS specific paths and variable name fixes
[xestiacalendar/.git]
/
source
/
common
/
random.cpp
diff --git
a/source/common/random.cpp
b/source/common/random.cpp
index
c661320
..
40316c6
100644
(file)
--- a/
source/common/random.cpp
+++ b/
source/common/random.cpp
@@
-1,6
+1,6
@@
// random.cpp - Random number generation.
//
// random.cpp - Random number generation.
//
-// (c) 2016 Xestia Software Development.
+// (c) 2016
-2017
Xestia Software Development.
//
// This file is part of Xestia Calendar.
//
//
// This file is part of Xestia Calendar.
//
@@
-21,7
+21,16
@@
using namespace std;
int GenerateRandomNumber(int powerOf){
using namespace std;
int GenerateRandomNumber(int powerOf){
-
+#if defined(WIN32)
+
+ // Seed the randomiser!
+
+ srand(time(0));
+
+ int powerOfCalculation = (int)pow(2, (double)powerOf);
+ int randomNumber = rand() % powerOfCalculation;
+
+#else
// Get four bytes from /dev/urandom.
int randomData = 0;
// Get four bytes from /dev/urandom.
int randomData = 0;
@@
-41,7
+50,7
@@
int GenerateRandomNumber(int powerOf){
int powerOfCalculation = (int)pow(2, (double)powerOf);
int randomNumber = rand() % powerOfCalculation;
int powerOfCalculation = (int)pow(2, (double)powerOf);
int randomNumber = rand() % powerOfCalculation;
+#endif
return randomNumber;
return randomNumber;
-
}
\ No newline at end of file
}
\ No newline at end of file
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software
Xestia Address Book
Xestia Calendar
Development
Xestia Gelforn
Everything else
About
News
Privacy Policy