FS2_Open
Open source remastering of the Freespace 2 engine
compatibility.cpp
Go to the documentation of this file.
2 #include "stdlib.h"
3 
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 }
int i
Definition: multi_pxo.cpp:466
void random_shuffle(int *first, int *last)
GLclampd n
Definition: Glext.h:7286
GLint first
Definition: Gl.h:1491
hull_check pos
Definition: lua.cpp:5050
int rand_function(int limit)
int temp
Definition: lua.cpp:4996
GLint limit
Definition: Glext.h:9797