Skip to content

Instantly share code, notes, and snippets.

@robink
Created November 3, 2011 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robink/1336647 to your computer and use it in GitHub Desktop.
Save robink/1336647 to your computer and use it in GitHub Desktop.
-1 | 1
var randomSign = function() {
return Math.cos( Math.round( Math.random() ) * Math.PI );
};
@DavidBruant
Copy link

var randomSign = function() {
  return Math.random() < 0.5 ? 1 : -1;
};

@robink
Copy link
Author

robink commented Nov 10, 2011

Yes ;) Same as the fork from Clément: https://gist.github.com/1354874 . I was bad this time :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment