private void ValidarDatos(int cantidad, DatosGeneradorTextos datos) { if (cantidad < 1) { throw new ArgumentOutOfRangeException("cantidad", "la cantidad de textos a generar debe ser mayor a 0"); } }
public string[] GenerarTextos(int cantidad, DatosGeneradorTextos datos) { ValidarDatos(cantidad, datos); var textos = new string[cantidad]; Parallel.For(0, cantidad, i => { textos[i] = _generador.GenerarTexto(datos); }); return(textos); }
public string[] GenerarTextos(int cantidad, DatosGeneradorTextos datos) { ValidarDatos(cantidad, datos); var textos = new string[cantidad]; for (var i = 0; i < cantidad; i++) { textos[i] = _generador.GenerarTexto(datos); } return(textos); }
public string GenerarTexto(DatosGeneradorTextos datos) { return(GenerarTexto(_random.Value.Next(datos.TamanoMinimo, datos.TamanoMaximo))); }