processing.js internally uses Math.random() as its internal random number generator. Aside from some additional multiplication steps depending on arguments, they’re essentially the same.
With mathematic calculations on a PC it won’t make a noticeable difference whichever you use. Even if you were generating thousands or even millions of random numbers your computer would be able to handle it faster than the blink of an eye.
If speed and/or memory is a major concern then you could try some third party libraries like this, however keep in mind that if memory (as in project size not ram) is a concern then it may be best not to add too many additional modules or libraries.
Problem :
does anyone know whether it is better (memory wise, or faster) to use Math.random() or random() in Khan Academy’s programming environment?
Used “random” as an example, I am reffering to any of the math libraries, really.