Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Triangular RV Symmetric vs. Asymmetric
(version: 0)
Comparing performance of:
Triangular vs Triangular Symmetric
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
function triangular(a, b, c) { const f = (c - a)/(b - a); const rand = Math.random(); let x; if (rand < f) { x = a + Math.sqrt(rand*(b - a)*(c - a)) } else { x = b - Math.sqrt((1 - rand)*(b - a)*(b - c)) } return x; } function triangularSymmetric(mean, radius) { let x; const doubleRadiusSquared = 2 * radius * radius; const rand = Math.random(); if (rand < 0.5) { x = mean - radius + Math.sqrt(rand*doubleRadiusSquared) } else { x = mean + radius - Math.sqrt((1 - rand)*doubleRadiusSquared) } return x; }
Tests:
Triangular
triangular(-1, 1, 0)
Triangular Symmetric
triangularSymmetric(0, 1)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Triangular
Triangular Symmetric
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
point in triangle
Random Integer Generator (favors numbers closer to 0)
Random Integer Generator (favors numbers closer to 0) 2
Triangular RV
Comments
Confirm delete:
Do you really want to delete benchmark?