Generaerandom no



  • Wow, this must be the worst article ever on Codeproject: http://www.codeproject.com/useritems/randm_no.asp

     Since it will be removed as soon as the admins of codeproject notice it I will post the content here:

     

    generaerandom no
    By sabuj_sen.

    generate random no in wo ways

    Introduction

    it is a usful code for generating random no...the random no generation process in two ways..
    one is using guid methd..another is random method.
    this code is very simsimple.it veryeasy to under stand and implement..
    the code us C#.net languages and using visual studio 2005. their is two eparate file .two ile contain two different processes.
    it isvery simple way to gnerate random no.
    you can easily use code in your projects...
    just unzip the file and run in the .net 2005 envioment using fremwork 2.0.

    Using the code

    the code us C#.net languages and using visual studio 2005. their is two eparate file .two ile contain two different processes.
    it isvery simple way to gnerate random no.
    just unzip the file and run in the .net 2005 envioment.
    Blocks of code should be set as style "Formatted" like this:

    //
    //   private Random random = new Random();
            private void GenerateRandomCode()
            {
               
                string s = "";
                for (int i = 0; i < 6; i++)
                    s = String.Concat(s, this.random.Next(10).ToString());
                //return s;
                label1.Text = s;
     
                 public void random()
            {
           
        String guidResult   = System.Guid.NewGuid().ToString();
        guidResult = guidResult.Replace("-", String.Empty);
     
        string str0 = guidResult.Substring(0,6);
        label1.Text=str0;
             }

            }//


    Remember to set the Language of your code snippet using the Language dropdown.

    Points of Interest

    this code is very simsimple.it veryeasy to under stand and implement..
    the code us C#.net languages and using visual studio 2005. their is two eparate file .two ile contain two different processes.
    it isvery simple way to gnerate random no.
    you can easily use code in your projects...
    just unzip the file and run in the .net 2005 envioment using fremwork 2.0.

    History

    Keep a running update of any changes or improvements you've made here.

    About sabuj_sen

        .net programer.

     



  • Naturally, a random number should be generated as a String.



  • Wow... just... wow...

     

    This reminds me of an article I found where someone posted a 'simple' way to 'safely' obtain passwords in C. 



  • This only makes the idea of outsourcing more painful. I can almost guess where this guy is from just by the dialect of Engrish he used to write that article.



  • int getRandomNumber() {

    return 4; // Chosen by fair die roll. 

    // Guaranteed to be random.



  • WTF is wrong with Guid.NewGuid? 

    Coming soon to your I.T. shop with the next wave of H1-Bs...



  • @pjsson said:

    Since it will be removed as soon as the admins of codeproject notice it I will post the content here:

    CodeProject has quality control? It's never showed before. There's some atrocious crap on there. 



  • I think this is a joke or a prank. At least I hope so. It would be a disturbing thought... a weapon as powerfull as VS2005 in the wrong hands...



  • @drinkingbird said:

    @pjsson said:

    Since it will be removed as soon as the admins of codeproject notice it I will post the content here:

    CodeProject has quality control? It's never showed before. There's some atrocious crap on there. 

    I know people who live & die by that site.  They are no longer employed as developers.



  • [quote user="Renan "C#" Sousa"]

    This only makes the idea of outsourcing more painful. I can almost guess where this guy is from just by the dialect of Engrish he used to write that article.

    [/quote]

    RACISM OMG!

    But, yeah, my thoughts exactly...



  • One thing you can take away from this is that it isvery simple way to gnerate random no.  That is important enough to say three times.



  • @operagost said:

    One thing you can take away from this is that it isvery simple way to gnerate random no.  That is important enough to say three times.

    Incidentally, am I the only one who, upon first reading it, thought that the code was going to generate the word "no" in different languages or something?



  • @TunnelRat said:

    WTF is wrong with Guid.NewGuid? 

    Last time I checked, the first six bytes of any GUID were constant across all GUIDs generated on a given Windows machine.



  • @Carnildo said:

    @TunnelRat said:

    WTF is wrong with Guid.NewGuid? 

    Last time I checked, the first six bytes of any GUID were constant across all GUIDs generated on a given Windows machine.

    Sounds like a regular V1 OSF DCE UUID, to me (and acronym-happy gits they are, too). It's the time in 100 nanoseconds combined with the MAC address of one of the interfaces of the host.



  • @Carnildo said:

    @TunnelRat said:

    WTF is wrong with Guid.NewGuid? 

    Last time I checked, the first six bytes of any GUID were constant across all GUIDs generated on a given Windows machine.

    As per the doc on CoCreateGuid (which .NET uses), this is untrue: http://msdn2.microsoft.com/en-us/library/ms688568.aspx


Log in to reply