random number generation
-
i wanna know how to create random numbers in c#. in my application i need to provide a default password if the user forgets the password. i wanna give this default password in the form of random numbers. pls help...
Hi, the .NET framework provides a Random-class. Have a look here: http://msdn.microsoft.com/en-us/library/system.random.aspx[^] Regards Sebastian
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
i wanna know how to create random numbers in c#. in my application i need to provide a default password if the user forgets the password. i wanna give this default password in the form of random numbers. pls help...
-
i wanna know how to create random numbers in c#. in my application i need to provide a default password if the user forgets the password. i wanna give this default password in the form of random numbers. pls help...
Hi Use Random class like
Random r = new Random();
givya wrote:
in my application i need to provide a default password if the user forgets the password
IMO ,If possible try to provide forgot password functionality like [Hint Question or Alternate Email]...
himanshu
-
Hi Use Random class like
Random r = new Random();
givya wrote:
in my application i need to provide a default password if the user forgets the password
IMO ,If possible try to provide forgot password functionality like [Hint Question or Alternate Email]...
himanshu
I gave the following code to generate the random string(searched it on internet). private string RandomString(int size, bool lowerCase) { StringBuilder builder = new StringBuilder(); Random random = new Random(); char ch; for (int i = 0; i < size; i++) { ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))); builder.Append(ch); } if (lowerCase) return builder.ToString().ToLower(); return builder.ToString(); } Bt its giving the following error: A using namespace directive can only be applied to namespaces; 'System.Text.StringBuilder' is a type not a namespace I hav used this also: "using System.Text.StringBuilder;" Pls help