Limit number of tags and display random in post content

I’m using this shortcode in post content to display tags

I’d like to limit the number of tags that are displayed.

I’d like to be able to also control whether random, asc, desc, and ideally most popular.

I’ve tried using $count but failing miserably. Alternative approach also welcome. Thanks

add_shortcode(‘tagsList’, ‘getTagList’);