CARLA
 
载入中...
搜索中...
未找到
RandomEngine.cpp
浏览该文件的文档.
1// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#include "Carla.h"
8#include "RandomEngine.h"
9
10#include <limits>
11
13{
14 // Tuned to be fast as this function might get called relatively often.
15 static thread_local std::mt19937_64 Engine((std::random_device())());
16 std::uniform_int_distribution<uint64> Distribution(
17 std::numeric_limits<uint64>::lowest(),
18 std::numeric_limits<uint64>::max());
19 return Distribution(Engine);
20}
21
23{
24 std::random_device RandomDevice;
25 std::uniform_int_distribution<int32> Distribution(
26 std::numeric_limits<int32>::lowest(),
27 std::numeric_limits<int32>::max());
28 return Distribution(RandomDevice);
29}
30
32{
34 std::numeric_limits<int32>::lowest(),
35 std::numeric_limits<int32>::max());
36}
std::minstd_rand Engine
int32 GetUniformIntInRange(int32 Minimum, int32 Maximum)
static uint64 GenerateRandomId()
Generate a non-deterministic random id.
static int32 GenerateRandomSeed()
Generate a non-deterministic random seed.
int32 GenerateSeed()
Generate a seed derived from previous seed.