Re: Hi

From: Richard Blewett [DevelopMentor] (richardb_at_develop.com)
Date: 09/27/04


To: microsoft.public.dotnet.languages.csharp
Date: Mon, 27 Sep 2004 04:12:26 -0700

Actually I'm talking rubbish - according to the docs the default constructor uses a time depent seed - ignore my post ;-)

 Regards

 Richard Blewett - DevelopMentor
 http://staff.develop.com/richardb/weblog

   nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<#qwMu9HpEHA.3464@tk2msftngp13.phx.gbl>

 The Random class has another constructor which takes a seed (a value used to start the number generator) the one you are using uses teh same seed so will produce the same sequence. Try using the TickCount (number of milliseconds since the machine started). i.e:
 
 Random R = new Random(Environment.TickCount);
 
 Regards
 
 Richard Blewett - DevelopMentor
 http://staff.develop.com/richardb/weblog
 
 nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/>
 
 Hi,
 
 I need to use Random numbers with in Maximum Limit.
 
 I have used Random Class from .Net Package.
 
 Random R =new Random();
 
 int I;
 
 for(I = 0; I < 10; I++)
 
 {
 
 MessageBox.Show(R.Next(I).ToString());
 
 }
 
 
 
 But it gives me a duplicate random number. So if any Other Class or Source
 Code for generate Random numbers in the loop variable please suggest me.
 
 
 
 Thanks for your help
 
 
 
 Mahendran
 
 
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (
http://www.grisoft.com).
 Version: 6.0.768 / Virus Database: 515 - Release Date: 22/09/2004
 
 
 
 [microsoft.public.dotnet.languages.csharp]
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.768 / Virus Database: 515 - Release Date: 22/09/2004

 
 [microsoft.public.dotnet.languages.csharp]



Relevant Pages

  • Re: Combo box refresh
    ... >> Richard Blewett - DevelopMentor ... In PopulateDatasetList how is this populating the combobox? ... Regards ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: passing parameter to thread ??
    ... Diving in before Jon does;-) ... Regards ... Richard Blewett - DevelopMentor ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Strong name trouble
    ... > Richard Blewett - DevelopMentor ... >> My code DOES NOT WORK if assemblies ARE strong name. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: AssemblyVersionAttribute
    ... Regards ... Richard Blewett - DevelopMentor ... the auto-generated revision number for an ...
    (microsoft.public.dotnet.framework)
  • Re: Messagebox.Show refresh
    ... Regards ... > Richard Blewett - DevelopMentor ... > In a C# application I use a message box to display an error. ...
    (microsoft.public.dotnet.framework)