I want to generate a random number then to check if it is in the database. If not then redo it.
My pseudo code:
PIN = GenerateRandomNumber().ToString();
// check if it is existing in the database
var listID = list_from_database
if (!listID.Contains(PIN))
// Save To database
else
{
// redo it until listID contains PIN
}