Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6941335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:52:20+00:00 2026-05-27T12:52:20+00:00

I am making a password generator that generates a random number, then I have

  • 0

I am making a password generator that generates a random number, then I have it converted to a letter using ascii. Inside the for loop, I need the letters to convert a string instead of a list. It works, but it just displays random letters as a list.

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

class MainClass
{
    static void Main()
    {
        int x = 1;
        int length;
        string a = "Press any key to continue";
        object num;


        while (x == 1)

        {
            Console.WriteLine("How many Characters would you like the Password to be? (Press -1 to Stop)");
            length = Convert.ToInt32(Console.ReadLine());
            try
            {
                for (int i = 0; i < length; i++)
                {
                    int num1 = Number();
                    Int32 ASCII = num1;
                    num = (char)num1;

                    if (length > 0)
                    {
                        Console.WriteLine(num);
                    }
                }
            }
            catch
            {
                Console.WriteLine(a);
            }

            if (length == -1)
                break;
        }
    }
    static Random _r = new Random();
    static int Number()
    {
        return _r.Next(65, 90); // decimal
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:52:21+00:00Added an answer on May 27, 2026 at 12:52 pm

    you can try this one

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace PasswordSample
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Generated password: {0}", GeneratePassword(12, true));
            }
    
            /// <summary>
            /// Generate a random password
            /// </summary>
            /// <param name="pwdLenght">Password lenght</param>
            /// <param name="nonAlphaNumericChars">Indicates if password will include non alpha-numeric</param>
            /// <returns>Return a password</returns>
            private static String GeneratePassword(int pwdLenght, bool nonAlphaNumericChars)
            {
                // Allowed characters
                String allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
    
                if (nonAlphaNumericChars)
                {
                    // Add non-alphanumeric chars
                    allowedChars += "-&@#%!*$?_";
                }
    
                char[] passwordChars = new char[pwdLenght];
                Random rnd = new Random();
    
                // Generate a random password
                for (int i = 0; i < pwdLenght; i++)
                    passwordChars[i] = allowedChars[rnd.Next(0, allowedChars.Length)];
    
                return new String(passwordChars);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a webservice call that needs and authentication password using jquery ajax.
I am thinking of making a password sequence for my app, like that in
I'm making a show password button for password input. Problem that is browsers don't
I am having a chop at making a password generator and manager. I was
I'm making a company back-end that should include a password-safe type feature. Obviously the
I have several classes (for a Form generator class thing I'm making...I know sad..
I am making a page that the user should enter his password again to
I have modify https://github.com/jimpick/everyauth-example-password/blob/master/server.js for making login with mysql. I want to access the
I am making a program with which to save banking information (i.e., account, password,
Making a word document of our network set-up. We have about 7 servers and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.