I want to get the random 10 products from whole product collection in magento2.
$productCollection = $this
->productModel
->getProductCollection()
->addAttributeToSelect('*');
$productCollection->getSelect()->orderRand();
$productCollection->setPagesize(10);
How to get the products without loading the whole product collection.
Thanks.