[PR #31] [CLOSED] Replace rand() with realtime-safe pcg-rand #28 #65

Closed
opened 2026-05-05 22:04:03 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/airwindows/airwindows/pull/31
Author: @x42
Created: 6/1/2021
Status: Closed

Base: masterHead: master


📝 Commits (2)

  • 85b4e65 Replace rand() with realtime-safe pcg-rand #28
  • 6e42b0c Replace 6 calls to rand() with one

📊 Changes

2 files changed (+50 additions, -28 deletions)

View changed files

📝 plugins/LinuxVST/src/Deckwrecka/Deckwrecka.h (+46 -0)
📝 plugins/LinuxVST/src/Deckwrecka/DeckwreckaProc.cpp (+4 -28)

📄 Description

On unices (Linux and macOS) the call to rand() takes a
lock (preserve global random seed) and is hence not realtime-safe.

On Windows this is less of an issue since rand() uses a thread-local
variable by default. However PCG-rand is still a preferable alternative.

--
NOTE: THIS CODE IS UNTESTED!
Other plugins using rand() should be updated likewise.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/airwindows/airwindows/pull/31 **Author:** [@x42](https://github.com/x42) **Created:** 6/1/2021 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (2) - [`85b4e65`](https://github.com/airwindows/airwindows/commit/85b4e654f357136efd1792991c20cfe4298bff2b) Replace rand() with realtime-safe pcg-rand #28 - [`6e42b0c`](https://github.com/airwindows/airwindows/commit/6e42b0ce94e68f55cb1198d47e3d264a55945bd9) Replace 6 calls to rand() with one ### 📊 Changes **2 files changed** (+50 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `plugins/LinuxVST/src/Deckwrecka/Deckwrecka.h` (+46 -0) 📝 `plugins/LinuxVST/src/Deckwrecka/DeckwreckaProc.cpp` (+4 -28) </details> ### 📄 Description On unices (Linux and macOS) the call to rand() takes a lock (preserve global random seed) and is hence not realtime-safe. On Windows this is less of an issue since rand() uses a thread-local variable by default. However PCG-rand is still a preferable alternative. -- NOTE: THIS CODE IS UNTESTED! Other plugins using rand() should be updated likewise. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 22:04:03 -06:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/airwindows#65
No description provided.