Skip to content

Commit 72837fc

Browse files
committed
better rand
1 parent bae0aaf commit 72837fc

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

src/App.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ const LiveDashboard = () => {
284284
useEffect(() => {
285285
const interval = setInterval(() => {
286286
setRpm(prev => {
287-
const delta = Math.floor(Math.random() * 150) - 75;
287+
const delta = Math.floor(Math.random() * 200) - 100;
288288
const newVal = prev + delta;
289289
// Clamp to realistic range (8200 - 8700)
290290
const clamped = Math.min(Math.max(newVal, 8200), 8700);
@@ -297,15 +297,11 @@ const LiveDashboard = () => {
297297
return Number((Math.max(40, Math.min(45, prev + delta))).toFixed(1));
298298
});
299299

300-
// Throttle correlates with RPM and temp
301-
setThrottle(() => {
302-
// Base throttle on RPM (normalized to 0-100%)
303-
const rpmFactor = ((rpmRef.current - 8200) / (8700 - 8200)) * 60;
304-
// Add temperature influence (higher temp = more throttle)
305-
const tempFactor = ((temp - 40) / (45 - 40)) * 30;
306-
// Slight random variation
307-
const randomFactor = (Math.random() * 10) - 5;
308-
const newThrottle = Math.round(Math.max(0, Math.min(100, rpmFactor + tempFactor + randomFactor)));
300+
// Throttle is more independent now
301+
setThrottle(prev => {
302+
// Random walk with larger variations
303+
const delta = Math.floor(Math.random() * 30) - 15;
304+
const newThrottle = Math.round(Math.max(30, Math.min(95, prev + delta)));
309305
throttleRef.current = newThrottle;
310306
return newThrottle;
311307
});

0 commit comments

Comments
 (0)