diff --git a/src/components/SkeletonText/SkeletonText.js b/src/components/SkeletonText/SkeletonText.js index c73bfbab1e56..96c8e52b19d5 100644 --- a/src/components/SkeletonText/SkeletonText.js +++ b/src/components/SkeletonText/SkeletonText.js @@ -12,6 +12,12 @@ import { settings } from 'carbon-components'; const { prefix } = settings; +const randoms = [0.973051493507435, 0.15334737213558558, 0.5671034553053769]; + +function getRandomInt(min, max, n) { + return Math.floor(randoms[n % 3] * (max - min + 1)) + min; +} + const SkeletonText = ({ paragraph, lineCount, @@ -32,14 +38,10 @@ const SkeletonText = ({ const widthPercent = width.includes('%'); - function getRandomInt(min, max) { - return Math.floor(Math.random() * (max - min + 1)) + min; - } - if (widthPercent && paragraph) { const lines = []; for (var i = 0; i < lineCount; i++) { - const randomWidth = getRandomInt(0, 75) + 'px'; + const randomWidth = getRandomInt(0, 75, i) + 'px'; lines.push(