Last active
June 2, 2017 12:56
-
-
Save Rishav159/9bb07225a5f57ff0720b9cd7cbbb7209 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f(i) { | |
return 1 + Math.sin(0.1 + (i * 0.7) * Math.cos(9 + i*0.3)) | |
} | |
generateRandomHill() { | |
let states = []; | |
let x = Math.random()*(30-5)+20; | |
let y = Math.random()*(100) | |
for(let i = 0; i < 100; i++) { | |
states.push(Math.floor(this.f(i/x + y)*(100-5) + 5)) | |
} | |
return states; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment