Last active
February 4, 2016 18:05
-
-
Save kandebonfim/3b7700a51bbf381dd6f3 to your computer and use it in GitHub Desktop.
A gist to generate an array with random numbers in CoffeeScript
This file contains hidden or 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
random = (min, max) => | |
Math.floor(Math.random() * (max - min) + min) | |
data = [1..100].map(() -> random(0,1000)) | |
↑↑↑ Array length | |
// One line | |
data = [1..100].map(() -> Math.floor(Math.random() * (1000 - 0) + 0)) | |
↑↑↑ Array length ↑max ↑min ↑min |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment