Generate n random posts from array:
const n = 4; // n random posts generator
const randomPosts = (function getRandomInt(max) {
return Math.floor(Math.random() * max);
})(posts.length - n);
{posts.slice(randomPosts, randomPosts + n).map(...}
//
No comments:
Post a Comment