diff --git a/.clang-tidy b/.clang-tidy index 0eab94b85..34f52d9d8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -9,7 +9,6 @@ Checks: > -clang-analyzer-optin.cplusplus.VirtualCall, -clang-analyzer-optin.osx.*, -clang-analyzer-osx.*, - -clang-analyzer-security.insecureAPI.rand, -clang-analyzer-unix.Malloc, -misc-const-correctness, -misc-misplaced-const, diff --git a/examples/shader/Shader.cpp b/examples/shader/Shader.cpp index 8be2f478c..36f612d6f 100644 --- a/examples/shader/Shader.cpp +++ b/examples/shader/Shader.cpp @@ -279,8 +279,9 @@ public: { // Spread the coordinates from -480 to +480 // So they'll always fill the viewport at 800x600 - m_pointCloud[i].position.x = static_cast(rand() % 960) - 480.f; - m_pointCloud[i].position.y = static_cast(rand() % 960) - 480.f; + std::uniform_real_distribution positionDistribution(-480, 480); + m_pointCloud[i].position.x = positionDistribution(rng); + m_pointCloud[i].position.y = positionDistribution(rng); } // Load the texture diff --git a/src/SFML/Audio/SoundFileWriterOgg.cpp b/src/SFML/Audio/SoundFileWriterOgg.cpp index 00e52c550..feea52f5d 100644 --- a/src/SFML/Audio/SoundFileWriterOgg.cpp +++ b/src/SFML/Audio/SoundFileWriterOgg.cpp @@ -32,8 +32,8 @@ #include #include #include -#include #include +#include namespace sf::priv @@ -63,7 +63,8 @@ bool SoundFileWriterOgg::open(const std::filesystem::path& filename, unsigned in m_channelCount = channelCount; // Initialize the ogg/vorbis stream - ogg_stream_init(&m_ogg, std::rand()); + static std::mt19937 rng(std::random_device{}()); + ogg_stream_init(&m_ogg, std::uniform_int_distribution(0, std::numeric_limits::max())(rng)); vorbis_info_init(&m_vorbis); // Setup the encoder: VBR, automatic bitrate management