FS2_Open
Open source remastering of the Freespace 2 engine
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
compatibility.cpp
Go to the documentation of this file.
1
#include "
globalincs/compatibility.h
"
2
#include "stdlib.h"
3
4
int
rand_function
(
int
limit
)
5
{
6
return
(rand() % limit);
7
}
8
9
// adapted from http://www.cplusplus.com/reference/algorithm/random_shuffle/
10
void
random_shuffle
(
int
*
first
,
int
*last)
11
{
12
random_shuffle
(first, last,
rand_function
);
13
}
14
15
// adapted from http://www.cplusplus.com/reference/algorithm/random_shuffle/
16
template
<
class
RandomNumberGenerator>
17
void
random_shuffle
(
int
*
first
,
int
*last, RandomNumberGenerator& custom_rand)
18
{
19
int
i
,
n
,
temp
;
20
n = (last-
first
);
21
22
for
(i=n-1; i>0; --
i
)
23
{
24
int
pos
= custom_rand(i+1);
25
temp = first[
i
];
26
first[
i
] = first[
pos
];
27
first[
pos
] =
temp
;
28
}
29
}
i
int i
Definition:
multi_pxo.cpp:466
random_shuffle
void random_shuffle(int *first, int *last)
Definition:
compatibility.cpp:10
n
GLclampd n
Definition:
Glext.h:7286
first
GLint first
Definition:
Gl.h:1491
compatibility.h
pos
hull_check pos
Definition:
lua.cpp:5050
rand_function
int rand_function(int limit)
Definition:
compatibility.cpp:4
temp
int temp
Definition:
lua.cpp:4996
limit
GLint limit
Definition:
Glext.h:9797
code
globalincs
compatibility.cpp
Generated on Sun May 1 2016 16:22:27 for FS2_Open by
1.8.10