0

Generate Unique Number Using a Unique String

Is there any way to generate a unique number using a unique string? For example: A string "abcd" would generate a unique number 1234 every time it passes through the algorithm.

4th Dec 2020, 2:14 AM
Subin Gyawali
Subin Gyawali - avatar
6 Respostas
+ 8
You can use UUID Module!
4th Dec 2020, 9:07 AM
Piyush
Piyush - avatar
0
Martin Taylor Does hash code generate only numbers or alpha numeric characters? I needed only integers.
4th Dec 2020, 2:23 AM
Subin Gyawali
Subin Gyawali - avatar
0
There are many ways As you have said that it should convert abcd to 1234 which means a is 1, b is 2, c is 3 and d is 4. There are 26 letters. You can make the program with just if else condition. if a Then 1 If b Then 2 If c then 3 If d Then 4 If e Then 5 If f Then 6 .... And continued.... Other way is using Hash Functions. Which will give you a unique number but it will be different in different tries.
4th Dec 2020, 5:38 AM
Muhammad Atif Waheed
Muhammad Atif Waheed - avatar