Skip to content

Instantly share code, notes, and snippets.

@tecnologer
Created November 17, 2022 16:05
Show Gist options
  • Save tecnologer/7b26d4be9577556d02cebe5c1fd40165 to your computer and use it in GitHub Desktop.
Save tecnologer/7b26d4be9577556d02cebe5c1fd40165 to your computer and use it in GitHub Desktop.
CodeQR
public class CodeQR
{
public Code Code {get;}
public CodeQR() {
Code = new Code();
}
public int GetCode()
{
string? result = null;
Random numRam = new Random();
for (int i = 0; i < 4; i++)
{
int? num= numRam.Next(0, 9);
if (result== null && num==0)
{
result += numRam.Next(1, 9);
}
else
{
result += numRam.Next(0, 9);
}
num = null;
}
return Convert.ToInt32(result);
}
public int GetCode2()
{
for(int i = 0; i < 20; i++)
{
int num = GetCode();
}
return 1;
}
}
public class Code
{
private constant LENGHT_CODE = 4;
private char[] digits = new char[LENGHT_CODE];
public Code()
{
for(int i = 0; i < LENGHT_CODE; i++)
{
digits[i] = (char)numRam.Next(48, 57);
}
}
public string ToString()
{
return
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment