You can use built-in functions in most programming languages to create a random number between 0 and 1:
Python: random.random()
Java: Random.nextFloat() or Random.nextDouble()
C/ C++: rand()
To convert this to a 2-digit number, multiply the random number by 100 and cast to integer.
There are a few ways to check for matching digits. One straightforward way to do this is to divide both the answer and the guess by 10. The first digit will be the quotient and the second digit will be the remainder.