Skip to main content
100%

Circles with Math.random and fill with jsx

✓ Published2🌍 Public
NNita
Last edited Feb 21, 2020
Created on Feb 21, 2020

This example displays a scatter of small circles generated from random positions. Each circle’s vertical coordinate comes from `Math.random()`, while its horizontal position and color are derived from an array of sequential numbers. The visualization uses React to render an SVG, mapping over a precomputed array to create circle elements. The code explicitly uses `Math.random()`, React’s `ReactDOM.render`, and JSX inside an `<svg>` container with a `g` transform, producing 201 circles with RGB fills based on their array index.

AI-generated description

React Starter code.

MIT Licensed

Similar vizzes