Random string at the end of slug

Hey!

When I generate slug for my pretty URLs, I want to be able to add to them a random hash - this way, if ever there will be a piece that repeats in title/slug, it will still have a unique URL.

Example of such URL:

https://mywebsite.com/here-my-pretty-url-a4041s98

Did anyone had a similar problem to solve? How did you achieve it?