mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 01:39:05 -05:00
DATV: leandvb: MSVC comaptible version of rand function
This commit is contained in:
parent
f77192eed7
commit
22b9ba23d0
@ -303,8 +303,8 @@ struct wgn_c : runnable
|
||||
|
||||
do
|
||||
{
|
||||
x = 2 * drand48() - 1;
|
||||
y = 2 * drand48() - 1;
|
||||
x = 2 * rand_compat() - 1;
|
||||
y = 2 * rand_compat() - 1;
|
||||
r2 = x * x + y * y;
|
||||
} while (r2 == 0 || r2 >= 1);
|
||||
|
||||
|
@ -782,7 +782,7 @@ struct s2_frame_receiver : runnable
|
||||
// is at same level as during steady-state demodulation.
|
||||
// This has no effect if the first detection is successful.
|
||||
float duty_factor = 5;
|
||||
discard = modcod_info::MAX_SYMBOLS_PER_FRAME * omega0 * (duty_factor+drand48()-0.5);
|
||||
discard = modcod_info::MAX_SYMBOLS_PER_FRAME * omega0 * (duty_factor+rand_compat()-0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,15 @@ inline float fmodfs(float v, float m)
|
||||
return (v>=m/2) ? v-m : (v<-m/2) ? v+m : v;
|
||||
}
|
||||
|
||||
inline double rand_compat()
|
||||
{
|
||||
#ifdef WIN32
|
||||
return double(rand())/RAND_MAX;
|
||||
#else
|
||||
return drand48();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Simple statistics
|
||||
|
||||
template<typename T>
|
||||
|
Loading…
Reference in New Issue
Block a user