Skip to main content
added 264 characters in body
Source Link
senthilkumar2185
  • 2.6k
  • 3
  • 23
  • 38
 *************** Code Block Start *************** 

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace randomnumbergeneration
{
    class Program
    {
        static void Main(string[] args)
        {




            Random rnd = new Random();



            IEnumerable<int> numbers = Enumerable.Range(0, 999999);
            List<int> lstnumbers = numbers.ToList();

            List<string> lstoutput = new List<string>();
            lstoutput.Add("Machine Name : " + Environment.MachineName + '\t' + "User Name : " + Environment.UserName);
            lstoutput.Add("Process start : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss.fff"));
            lstnumbers.ForEach(x =>
            {

                lstoutput.Add(rnd.Next(0, 999).ToString());
            });
            lstoutput.Add("Process end : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss.fff"));
            System.IO.File.WriteAllLines("D:\\randtest.txt", lstoutput);



        }
    }
}


       *************** Code Block End *************** 

`>

` Approach Explanation Start ***************

  1. as per requirement used random and I am using c# language.
  2. Enumerable range generate the numbers from 0 to 1 million numbers. so its very fast.
  3. generated numbers transfer to list. list is very fast execution so transferred to list. in the list used foreach so every number executed.
  4. already created string list in the list added generated random numbres 0 to 999.
  5. write to txt file in particular specific folder.

Approach Explanation End ***************

Code Execution time and Machine name Start ***************

Machine Name : USP1472 User Name : USPSK1472 Process start : 19/09/2025 10:42:49.943 Process end : 19/09/2025 10:42:50.123 process start and end time added in the output file. while execute the code automatically added process start and end time with machine details.

Code Execution time and Machine name End***************

This is first time I am attending the code challenge with stackoverflow I am very happy to attend this code challenge. ``

 *************** Code Block Start *************** 

 Random rnd = new Random();



            IEnumerable<int> numbers = Enumerable.Range(0, 999999);
            List<int> lstnumbers = numbers.ToList();

            List<string> lstoutput = new List<string>();
            lstoutput.Add("Machine Name : " + Environment.MachineName + '\t' + "User Name : " + Environment.UserName);
            lstoutput.Add("Process start : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss.fff"));
            lstnumbers.ForEach(x =>
            {

                lstoutput.Add(rnd.Next(0, 999).ToString());
            });
            lstoutput.Add("Process end : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss.fff"));
            System.IO.File.WriteAllLines("D:\\randtest.txt", lstoutput);

       *************** Code Block End *************** 

`>

` Approach Explanation Start ***************

  1. as per requirement used random and I am using c# language.
  2. Enumerable range generate the numbers from 0 to 1 million numbers. so its very fast.
  3. generated numbers transfer to list. list is very fast execution so transferred to list. in the list used foreach so every number executed.
  4. already created string list in the list added generated random numbres 0 to 999.
  5. write to txt file in particular specific folder.

Approach Explanation End ***************

Code Execution time and Machine name Start ***************

Machine Name : USP1472 User Name : USPSK1472 Process start : 19/09/2025 10:42:49.943 Process end : 19/09/2025 10:42:50.123 process start and end time added in the output file. while execute the code automatically added process start and end time with machine details.

Code Execution time and Machine name End***************

This is first time I am attending the code challenge with stackoverflow I am very happy to attend this code challenge. ``

 *************** Code Block Start *************** 

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace randomnumbergeneration
{
    class Program
    {
        static void Main(string[] args)
        {




            Random rnd = new Random();



            IEnumerable<int> numbers = Enumerable.Range(0, 999999);
            List<int> lstnumbers = numbers.ToList();

            List<string> lstoutput = new List<string>();
            lstoutput.Add("Machine Name : " + Environment.MachineName + '\t' + "User Name : " + Environment.UserName);
            lstoutput.Add("Process start : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss.fff"));
            lstnumbers.ForEach(x =>
            {

                lstoutput.Add(rnd.Next(0, 999).ToString());
            });
            lstoutput.Add("Process end : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss.fff"));
            System.IO.File.WriteAllLines("D:\\randtest.txt", lstoutput);



        }
    }
}


       *************** Code Block End *************** 

`>

` Approach Explanation Start ***************

  1. as per requirement used random and I am using c# language.
  2. Enumerable range generate the numbers from 0 to 1 million numbers. so its very fast.
  3. generated numbers transfer to list. list is very fast execution so transferred to list. in the list used foreach so every number executed.
  4. already created string list in the list added generated random numbres 0 to 999.
  5. write to txt file in particular specific folder.

Approach Explanation End ***************

Code Execution time and Machine name Start ***************

Machine Name : USP1472 User Name : USPSK1472 Process start : 19/09/2025 10:42:49.943 Process end : 19/09/2025 10:42:50.123 process start and end time added in the output file. while execute the code automatically added process start and end time with machine details.

Code Execution time and Machine name End***************

This is first time I am attending the code challenge with stackoverflow I am very happy to attend this code challenge. ``

Source Link
senthilkumar2185
  • 2.6k
  • 3
  • 23
  • 38

 *************** Code Block Start *************** 

 Random rnd = new Random();



            IEnumerable<int> numbers = Enumerable.Range(0, 999999);
            List<int> lstnumbers = numbers.ToList();

            List<string> lstoutput = new List<string>();
            lstoutput.Add("Machine Name : " + Environment.MachineName + '\t' + "User Name : " + Environment.UserName);
            lstoutput.Add("Process start : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss.fff"));
            lstnumbers.ForEach(x =>
            {

                lstoutput.Add(rnd.Next(0, 999).ToString());
            });
            lstoutput.Add("Process end : " + DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss.fff"));
            System.IO.File.WriteAllLines("D:\\randtest.txt", lstoutput);

       *************** Code Block End *************** 

`>

` Approach Explanation Start ***************

  1. as per requirement used random and I am using c# language.
  2. Enumerable range generate the numbers from 0 to 1 million numbers. so its very fast.
  3. generated numbers transfer to list. list is very fast execution so transferred to list. in the list used foreach so every number executed.
  4. already created string list in the list added generated random numbres 0 to 999.
  5. write to txt file in particular specific folder.

Approach Explanation End ***************

Code Execution time and Machine name Start ***************

Machine Name : USP1472 User Name : USPSK1472 Process start : 19/09/2025 10:42:49.943 Process end : 19/09/2025 10:42:50.123 process start and end time added in the output file. while execute the code automatically added process start and end time with machine details.

Code Execution time and Machine name End***************

This is first time I am attending the code challenge with stackoverflow I am very happy to attend this code challenge. ``