How to distinguish between random and public GAP addresses?

Hello, I am writing an application in Qt that runs on the computer and interacts with a nRF51422 via BLE. Now I have noticed, that I have to tell the framework, which address type is used. When I try to connect to the nRF51 with Qt set to PublicAddress, I simply get a timeout.

I wanted to establish a connection to the nRF51 and scan for the services to determine if the device is the right one. But then I need to know what type of address I am dealing with.

Is there any algorithm to check if a BLE address is public or random? In the TI forums I read that the two MSBs differ for the three types of random addresses. But is there a similar code to distinguish a random address from a public address?