Magento get products from category randomly

Just follow the below code
$products = Mage::getModel(‘catalog/product’)
->getCollection()
->addAttributeToSort()
->addAttributeToSelect(‘small_image’)
->addCategoryFilter(Mage::getModel(‘catalog/category’)->load());
$products->getSelect()->order(new Zend_Db_Expr(‘RAND()’));