Powers of 2 (Doubling Numbers) in JavaScript

This is a program I wrote in JavaScript that constantly doubles a number starting at 1 (powers of 2). It is written to avoid an integer overload caused by a number becoming too large and getting converted to a number such as “8.6086919e+436”. It does this by essentially treating the number as a string, and multiplying … Read morePowers of 2 (Doubling Numbers) in JavaScript

JavaScript “Dust” With Distance-Based Probabilities

I recently wrote a program in JavaScript that generates “dust” by picking a random pixel on the screen, then deciding randomly whether to shade it in or not. The farther away the pixel is from a certain point (in this case, (700, 350)), the lower the chance it will be shaded in. To determine the … Read moreJavaScript “Dust” With Distance-Based Probabilities

Generating Random Numbers With JavaScript

I wrote a JavaScript program to create random digits, then used it to create a list of 1,000,000. I’ve copied the first 250,000 to a Word document, so if you want, you can download them (145 kilobytes). After a specified amount of digits, a red number shows how many have been generated so far (if enabled). … Read moreGenerating Random Numbers With JavaScript

Mandelbrot Program – Added Shading

I added basic shading to my Mandelbrot fractal program. If you haven’t seen that, here’s a link. Anyway, for each pixel it takes the number of iterations of z=z2+c in order for the coordinates to escape the Mandelbrot set, and bases the color off of that. Picture: Right now, however, it can only use shades … Read moreMandelbrot Program – Added Shading

Mandelbrot Set Generation Program

This is a program I wrote that generates the Mandelbrot fractal (here’s a Wikipedia article about it), written in JavaScript, using the HTML5 canvas. For each pixel, it evaluates a recursive formula, z=z2+c, based on the coordinates of that pixel. If, after the z value is fed back into the formula a certain number of … Read moreMandelbrot Set Generation Program