Olá,
Não sei se é a melhor forma, mas pensei inicialmente nisso:
public int GerarNumeroAleatorio(int length)
{
Random r = new Random();
int inicial = Convert.ToInt32("1" + new string('0', length-1));
int final = Convert.ToInt32("9" + new string('9', length-1));
return r.Next(inicial, final);
}
Se a resposta for relevante ou tenha resolvido seu problema, marque como útil/resposta!
André Secco
Microsoft MVP & MSDN Tech Advisor
Blog: http://andresecco.com.br
GitHub: http://github.com/andreluizsecco
Twitter: @andre_secco