Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const generateNodes = ({
- numberOfColumns,
- numberOfRows,
- }) => (
- Array(
- numberOfColumns
- * numberOfRows
- )
- .fill()
- .map((
- item,
- index,
- ) => ({
- colorId: (
- Math
- .floor(
- Math.random() * 3
- )
- ),
- id: index,
- x: index % numberOfColumns,
- y: Math.floor(index / numberOfColumns),
- }))
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement