Your problem is not clear.
Check help-basics-conditions for explanation about IF statement. Using AND and OR enables comparison of multiple variables.
This has nothing to do with "random unique function"
If this is not what you need - please state it more clearly.