Collborative filtering converting string user-ids & movie-ids into numbers

Hi,

In my case, user IDs and video IDs are in strings. How do I convert them in numbers? Also if I just map strings to random numbers that generated, should this solution work?