I am making a random image generator, which needs to display 14 random images. This works, however those 14 random images are being replaced with others 3 times in a call.
I don't want this to happen, but I have no clue on how to stop this. I think that math.random() is causing the issue, but I'm not sure. I am running this script on React.JS
My code:
for (var g=0; g < 14; g++) {
var rdmNumber = Math.floor(Math.random() * 14) + 1;
var imgName = "img_" + rdmNumber +".png";
var src = "img" + "/" + imgName;
indents.push(<div className="item-picture" key={c}><img src= {src8}className="item-img" alt="Your possible winnings" /></div>);
}
The indents.push is the output of my call, which is being displayed as followed:
{indents}
.gif from what is happening: https://gyazo.com/c576c52a90843a9ab055790610303fe4
Thanks in advance.
EDIT I don't need unique images, I just want them to stay the same, and not replace as seen in the .gif