Not so random Randomizer



  • import tools.*;

    class tools.Randomizer {
       
        static private var number:Number = 0;
       
        static function getNumber():Number {
            return number++;
        }
       
    }

     

    Random isn't random, but this...



  •  Guaranteed to be unique, I guess.



  • He should add a random amount to it instead.  As of right now, he will never get any negatives, 0s, or decimals.

    <FONT size=3><FONT face=Calibri>And just to get it out of the way… this reminds of an overly abused xkcd that must never be linked: <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT>

     

    [mod - you were warned]


  • @dhromed said:

    Guaranteed to be unique, I guess.

    As long as there's only one thread...but then, true randomness is not unique, so I guess that's as ok as anything else about this.



  • I don't see a huge problem with this if it is used solely in a testing environment ... adds some ... predictabilty ... when testing something expected to be random.

    Much like using a fake system clock which only ticks once every time it is accessed.



  • I'm curious why this exists. What is it used for?



  • @morbiuswilters said:

    I'm curious why this exists. What is it used for?

     It is used for generating id's... In multiple production environments.

    I wish it was unique, 'cause that would mean it works as intended...

    But it is not really a randomizer, but an ID generator.



  • @chillisaus said:

    @morbiuswilters said:

    I'm curious why this exists. What is it used for?

     It is used for generating id's... In multiple production environments.

    I wish it was unique, 'cause that would mean it works as intended...

    But it is not really a randomizer, but an ID generator.

    Ah, I see. Also, what language is this?



  •  @morbiuswilters said:

    Also, what language is this?

    colon-type notation suggests Delphi, if I am not mistaken.

    Or Pascal.



  • @dhromed said:

    colon-type notation suggests Delphi, if I am not mistaken.

    Or Pascal.

    Very unlikely - { } are comment separators in Pascal/Delphi.



  •  Heh, this might be TRWTF, but it's ActionScript. 2.0 that is...



  • @chillisaus said:

     Heh, this might be TRWTF, but it's ActionScript. 2.0 that is...

    Server-side actionscript? I didn't even know that was possible..



  • @ender said:

    @dhromed said:

    colon-type notation suggests Delphi, if I am not mistaken.

    Or Pascal.

    Very unlikely - { } are comment separators in Pascal/Delphi.
    TRWTF.

    @zelmak said:

    I don't see a huge problem with this if it is used solely in a testing environment ... adds some ... predictabilty ... when testing something expected to be random.

    So does srand(0), and that still gives random-looking numbers.



  • @morbiuswilters said:

    Server-side actionscript?
     

    Who said it was server-side?



  • @dhromed said:

    @morbiuswilters said:

    Server-side actionscript?
     

    Who said it was server-side?

    He said it was used for "generating IDs in multiple production environments". That definitely sounds like server-side work to me, but maybe not.



  • @Anketam said:

    He should add a random amount to it instead.  As of right now, he will never get any negatives, 0s, or decimals.

    <font size="3"><font face="Calibri">And just to get it out of the way… this reminds of an overly abused xkcd that must never be linked: </font></font>

     

    [mod - you were warned]

    Woohoo! Rosie's *hot*!



    [I'm only putting one Rosie here because there's already been enough awfulness in this thread. -TheShadowMod]



  • @morbiuswilters said:

    He said it was used for "generating IDs in multiple production environments". That definitely sounds like server-side work to me, but maybe not.

    Grandma's Facebook open to Farmville = "production environment".



  • @D-Coder said:

    @Anketam said:

    He should add a random amount to it instead.  As of right now, he will never get any negatives, 0s, or decimals.

    <FONT size=3><FONT face=Calibri>And just to get it out of the way… this reminds of an overly abused xkcd that must never be linked: </FONT></FONT>  <Rosie picture>

     

    [mod - you were warned]

    Woohoo! Rosie's *hot*!

    <Hot Rosie Picture>

    [I'm only putting one Rosie here because there's already been enough awfulness in this thread. -TheShadowMod]
    The only reason why I have a Rosie picture was I was testing to see if the moderators would catch the forbidden link, and they did.  I was killing over laughing at how fast they caught and fixed it.


  • @Anketam said:

    The only reason why I have a Rosie picture was I was testing to see if the moderators would catch the forbidden link, and they did.  I was killing over laughing at how fast they caught and fixed it.

    Surely this is achievable by a bit of regex on an input filter?

    It's not a manual process.. is it?



  • @Cassidy said:

    @Anketam said:
    The only reason why I have a Rosie picture was I was testing to see if the moderators would catch the forbidden link, and they did.  I was killing over laughing at how fast they caught and fixed it.
    Surely this is achievable by a bit of regex on an input filter?

    It's not a manual process.. is it?

    Well it did not instantly change, so I doubted that it was an auto script, it could be and it just took a while to run, specially if it needed to find a super special awesome picture of Rosie.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.