!function () { function GetProducts(top) { var productArray = [{"pid":158675476,"name":"Baldur's Gate 3 (Gra PS5)","price":264.9900,"sprice":"264,99","url":"https://www.ceneo.pl/158675476#pid=24529&crid=491212&cid=42164","imgurl":"//image.ceneostatic.pl/data/products/158675476/f-baldur-s-gate-3-gra-ps5.jpg","newpage":true,"format":"custom","rating":5.0,"drawchance":1,"urltype":0,"position":1},{"pid":182613466,"name":"The Alters (Gra PS5)","price":147.9900,"sprice":"147,99","url":"https://www.ceneo.pl/182613466;basket#pid=24529&crid=491212&cid=42164","imgurl":"//image.ceneostatic.pl/data/products/182613466/f-the-alters-gra-ps5.jpg","newpage":true,"format":"custom","rating":0.0,"drawchance":1,"urltype":0,"position":2},{"pid":76096341,"name":"Anno 1800 (Digital)","price":61.4500,"sprice":"61,45","url":"https://www.ceneo.pl/76096341;basket#pid=24529&crid=491212&cid=42164","imgurl":"//image.ceneostatic.pl/data/products/76096341/f-anno-1800-digital.jpg","newpage":true,"format":"custom","rating":4.61,"drawchance":1,"urltype":0,"position":3},{"pid":72339395,"name":"Farmer's Dynasty (Digital)","price":12.4400,"sprice":"12,44","url":"https://www.ceneo.pl/72339395#pid=24529&crid=491212&cid=42164","imgurl":"//image.ceneostatic.pl/data/products/72339395/f-farmer-s-dynasty-digital.jpg","newpage":true,"format":"custom","rating":5.0,"drawchance":1,"urltype":0,"position":4}]; var sum = 4; var result = []; var i = 0, n = 0; for (var n = 0; n < top; n++) { var r = Math.floor(Math.random() * sum); var lsum = 0; for (i = 0; i < productArray.length; i++) { var prod = productArray[i]; lsum += prod.drawchance; if (r < lsum) { sum -= prod.drawchance; result.push(prod); productArray.splice(i, 1); break; } } } return result; } function htmlEncode(value){ var div = document.createElement('div'); var text = document.createTextNode(value); div.appendChild(text); return div.innerHTML; } var html = ''; var products = GetProducts(4); var rows = 4, columns = 1, r = 0, c = 0; html += '