AP_Math: Moves rand_vec3f from SITL_State.
This commit is contained in:
parent
86b9942d51
commit
7cea21afa2
@ -218,4 +218,15 @@ float rand_float(void)
|
||||
{
|
||||
return ((((unsigned)random()) % 2000000) - 1.0e6) / 1.0e6;
|
||||
}
|
||||
|
||||
Vector3f rand_vec3f(void)
|
||||
{
|
||||
Vector3f v = Vector3f(rand_float(),
|
||||
rand_float(),
|
||||
rand_float());
|
||||
if (v.length() != 0.0f) {
|
||||
v.normalize();
|
||||
}
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
|
@ -246,3 +246,5 @@ uint16_t get_random16(void);
|
||||
// generate a random float between -1 and 1, for use in SITL
|
||||
float rand_float(void);
|
||||
|
||||
// generate a random Vector3f of size 1
|
||||
Vector3f rand_vec3f(void);
|
||||
|
Loading…
Reference in New Issue
Block a user