I am using the following method which works but wondering if there is a better algorithm to perform the test. Is there a better way to do it? Doing this in C# but putting syntax
A simple JavaScript implementation using sine wave function to calculate result:
No if's required, just for fun...
Check it