How does typecho get a specified number of categories

in the typecho official document, the following code gets all the categories

$this->widget("Widget_Metas_Category_List")->parse("<li><a href="{permalink}">{name}</a></li>"

want not to output all categories, as long as a specified number of categories (for example, only 2 categories), how should I write?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b374b4-2c068.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b374b4-2c068.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?