Skip to content

Commit daa8bb1

Browse files
committed
do not use drand48(); it only exists on POSIX-compliant systems
1 parent ea778e3 commit daa8bb1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pocketfft_demo.cc

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
using namespace std;
88
using namespace pocketfft;
99

10+
// floating point RNG which is good enough for sinmple demos
11+
// Do not use for anything important!
12+
inline double simple_drand()
13+
{
14+
constexpr double norm = 1./RAND_MAX;
15+
return rand()*norm;
16+
}
17+
1018
template<typename T> void crand(vector<complex<T>> &v)
1119
{
1220
for (auto & i:v)
13-
i = complex<T>(drand48()-0.5, drand48()-0.5);
21+
i = complex<T>(simple_drand()-0.5, simple_drand()-0.5);
1422
}
1523

1624
template<typename T1, typename T2> long double l2err

0 commit comments

Comments
 (0)