Showing 179 scripts

Sort by name or size

Math.extend

Math.extend

This JavaScript extension for Prototype.js aims to provide more tools and functions for math-related development. It extends Math native object, Number and Array native classes. Latest version: 0.5.0 released on 2009-03-26.
  •  
  • New for this release:
  • Math.variance()
  • speed improvements for Number#isPrime and Math.factorize()


var myNumber = -12;
myNumber.isOdd(); // -> false
(42602).isEven(); // -> true
myNumber.isInteger(); // -> true
(289341211).isPrime(); // -> true, it is a prime number
[1,2,3,4,5].shuffle(); // -> shuffles & returns array
[1,2,3,4,5].randomDraw(3) // -> returns 3 random items
Math.stdDev([78, 88, 93, 67, 89, 75, 91]); // -> approx. 9
Website:
Math.extend
Author:
Laurent Fortin
Size:
2.8 KB
Last modified:
05/28/2009
License:
MIT
Tags:
syntactic sugar
Rating:
5
(5/5 from 1 vote)
Your rating:
Please sign in or register to rate this script
Select multiple tags with Ctrl+click (Cmd+click on Mac)

Found a bug or have a suggestion?Let us know

bitsonnet corp · © 2007-2014 · all rights reserved

Sign In / Register / Forgot password