1//
2// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7#include "random_utils.h"
8#include <time.h>
9#include <cstdlib>
10
11float RandomBetween(float min, float max)
12{
13    static bool randInitialized = false;
14    if (!randInitialized)
15    {
16        srand(time(NULL));
17        randInitialized = true;
18    }
19
20    const size_t divisor = 10000;
21    return min + ((rand() % divisor) / static_cast<float>(divisor)) * (max - min);
22}
23