X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/a41763dd463339765081c1f968a7b93b8ccf572f..a0666be3ab58ed83ad6d622cfe2b8293c40dffbb:/lib/screens/random.js diff --git a/lib/screens/random.js b/lib/screens/random.js index 6ac706f..d5de257 100644 --- a/lib/screens/random.js +++ b/lib/screens/random.js @@ -1,25 +1,29 @@ 'use strict'; -// random colors -const Random = function (modulation, width, height, renderer) { - let response = ''; +/** + * Draws random colors + * + * @function RandomScreen + * @implements IScreen + */ +module.exports = function (modulation, width, height, renderer) { - for (let i = 0; i < height; i++) { - for (let j = 0; j < width; j++) { - let red = Math.floor(Math.random() * 255); - let blue = Math.floor(Math.random() * 255); - let green = Math.floor(Math.random() * 255); + let response = ''; - response = response + renderer(red, blue, green); - response = response + ' '; - } + for (let i = 0; i < height; ++i) { + for (let j = 0; j < width; ++j) { + const red = Math.floor(Math.random() * 255); + const blue = Math.floor(Math.random() * 255); + const green = Math.floor(Math.random() * 255); + + response = response + renderer(red, blue, green); + response = response + ' '; + } - if (i < height - 1) { - response = response + '\n'; + if (i < height - 1) { + response = response + '\n'; + } } - } - return response; + return response; }; - -module.exports = Random;