From 9a952c889fdddb438b3cbb11153f1b0c7927fb99 Mon Sep 17 00:00:00 2001
From: Thomas Harte <thomas.harte@gmail.com>
Date: Wed, 15 Jul 2020 22:44:54 -0400
Subject: [PATCH] Fixes exit from random gain noise.

---
 Storage/Disk/Drive.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Storage/Disk/Drive.cpp b/Storage/Disk/Drive.cpp
index ad3082a22..ae7c76c56 100644
--- a/Storage/Disk/Drive.cpp
+++ b/Storage/Disk/Drive.cpp
@@ -282,7 +282,7 @@ void Drive::get_next_event(float duration_already_passed) {
 
 		// If this random transition is closer than 5µs to the next real bit,
 		// discard it.
-		if(random_interval_ < current_event_.length - 5.0f / 1'000'000.f) {
+		if(random_interval_ - 5.0f / 1'000'000.f < current_event_.length) {
 			random_interval_ = 0.0f;
 		} else {
 			random_interval_ -= current_event_.length;