I have a task where i'm supposed to send a certain percentage of the users to one location, and the rest to another location.
I have an idea where I want to use the session key and modulus, but I don't know how to implement it. Some pseudocode:
# 1. Convert every character to a number using ord?
# 2. ???
# 3. use modulus 100 on the converted string to get 1 or 0
if (($converted_string % 100) < $percentage)
$location = "new location";
$location = "old location";
As you can see I'm quite clueless on this, but it's more of a mathematical problem than a code problem. I know that I need to do some calculations on the string before I can use modulus on it, but how?