xref: /haiku/src/tests/servers/app/benchmark/TestSupport.h (revision 7b0cfaa56938ddf13439b3b1eeb9e8caf6b04ff1)
1 /*
2  * Copyright (C) 2008 Stephan Aßmus <superstippi@gmx.de>
3  * All rights reserved. Distributed under the terms of the MIT license.
4  */
5 #ifndef TEST_SUPPORT_H
6 #define TEST_SUPPORT_H
7 
8 #include <math.h>
9 #include <stdlib.h>
10 
11 // random_number_between
12 inline float
random_number_between(float v1,float v2)13 random_number_between(float v1, float v2)
14 {
15 	if (v1 < v2)
16 		return v1 + fmod(rand() / 1000.0, (v2 - v1));
17 	else if (v2 < v1)
18 		return v2 + fmod(rand() / 1000.0, (v1 - v2));
19 	return v1;
20 }
21 
22 #endif // TEST_SUPPORT_H
23