Home AMX User Forum NetLinx Studio

Random Number Generation?

Greetings,

Does Netlinx contain any function for random number generation?

Comments

  • Ooh, what do you want that for? I'm intrigued!
  • Spire_JeffSpire_Jeff Posts: 1,917
    The syntax is:

    Num = RANDOM_NUMBER(1000) // 0 <= Num < 1000

    Jeff
  • TurnipTruckTurnipTruck Posts: 1,485
    A conditional access module for people who have a reputaion for not paying their bills.
  • I tried using a random number generator to have a variety of touchpanel backgrounds appear when a panel woke up. The generator didn't work for me though (always returned a one, I think) so I'd be interested if it does what you want it to. You can get the syntax in Keywords Help.

    Jeff
  • TurnipTruckTurnipTruck Posts: 1,485
    I would be using it to generate five three-digit random number which are mathematically related by a formula.That number is read to me from a remote site and I calculate the relationship and give the result to the remote site operator to punch into the system. If the number matches the calculation, the system is autorized.

    This is all in effort to be paid for my work!
  • Very interesting idea. If it works please post it. :)
  • mpullinmpullin Posts: 949
    If you wanted to be a little more malicious you could try a time bomb attack, where there's a date hard coded into the system, and no button pushes work if DATE is after this date. (Unless you are paid in which case you'd swiftly set the date on the master to some day in 1970 and the undocumented feature would disappear)

    ... not that this reflects the opinions of my company or myself, or anyone.
  • JoeJoe Posts: 99
    I've used the random number generator in the past to flash random points on the touchpanel during system warmup. I'd divide the screen into a 20x20 grid, then have all the buttons invisible in the off state and the on state would either be a round button or once, the company logo. Put all of the buttons into an array, generate a random number between 1-400, pulse the corresponding button on and off, then go to the next. It's a pretty cool effect.

    Joe
  • viningvining Posts: 4,368
    I recently wrote a program to do basically what you want. I embedded the code in an otherwise harmless module so if any one went looking for it, it would not be found. You would have to pull out modules one at a time until the offending module was found. But that's not easy either because for 30 days after the cut off date it would just pop up the message in the attached PNG file only once a day, so during this period you would have to wait until the next day to pull a different module to see if that stopped the pop up. The code checks for an XML file on the RAM and in the file is a key at least there is when paid in full. When the date is reached and the key is not found once a day for 30 days again the pop up message appears. Every day when the message appears it lets you know how many days are left until deactivation which doesn't really deactivate any thing, it just reboots the master on the hour and it reboots all TPs 45 minutes past the hour and pops up the message 1/2 past the hour.

    Once paid in full the key could be entered through the TP or I could FTP the XML file into the master.

    I ran a thread which discussed my desired to do something like this after it was already installed and the dead line approaching. The general consensus at that time was it was the wrong approach. That it was a little vindictive and probably illegal or something to that affect and this was by forum members that most of you know and respect. I posted the thread because I also had doubts that this was a proper approach so I'm not sure if I would do it again. So a word of caution when pursuing this type of alternative it may back fire.

    That said, the cut off date came, the customer saw the pop up and subsequently made final payment.
  • yuriyuri Posts: 861
    i dont know about the whole key protected software thing... I think it's better to have the customer pay in advance. Like a 40/40/20% thing.
  • alexanboalexanbo Posts: 282
    Just a thought about the pop-up page.

    To disable it all you'd have to do is delete the pop-up page from the tpd file. Do you password protect the tpd file as well?
  • viningvining Posts: 4,368
    alexanbo wrote:
    To disable it all you'd have to do is delete the pop-up page from the tpd file. Do you password protect the tpd file as well?
    True, if the customer hired soemone else they could remove the pop up for the TPD file which would eliminate the pop during the 30 days period but after that it would reboot the master on the hour ever hour and reboot the TPs 45 minutes past the hour , every hour. The working code is embedded in a compiled module that has nothing to do this function so tracking it down would take some time and if found the host module would have to be removed eliminating that functionality.

    No, I don't password protect the TPD file. Chances are if they bring someone else in to do anything this would all end up in the courts to resolve.
    yuri wrote:
    I think it's better to have the customer pay in advance. Like a 40/40/20% thing.
    Who doesn't. This was just my non professional bad attemp to remedy a bad situation. At the time I was pissed, bitter and wanted some form of satisfaction. Obviously better business practices that would require payment prior to completion or with holding the source until final payment is made as well as a host of other better alternatives would be better than this or what this thread starter is attemping to do.

    To be honest I can'tsay I wouldn't do it again to at least maintain the option should preffered methods fail but it's not something I would advocate. Handling this through proper business practices is ideal and if that fails through proper legal recourse. Although I like to think of this method as a forceful nudge to avoid the legal recourse.
  • TurnipTruckTurnipTruck Posts: 1,485
    yuri wrote:
    i dont know about the whole key protected software thing... I think it's better to have the customer pay in advance. Like a 40/40/20% thing.

    Absolutely. It's that last payment that I wan't to be sure to get.
  • vining wrote:
    I embedded the code in an otherwise harmless module so if any one went looking for it, it would not be found. You would have to pull out modules one at a time until the offending module was found.

    Just out of curiosity, could you have just written that in plain text in the code and then just not include the source code when transferring to the Netlinx?
    TIMELINE_EVENT
    {
         IF PAYMENT_RECIEVED = 0
         {
             INITIATE ANNOYING REBOOT SEQUENCE
         }
         IF PAYMENT_RECIEVED = 1
         {
             TERMINATE ANNOYING REBOOT SEQUENCE
         }
    }
    
  • ericmedleyericmedley Posts: 4,177
    Just out of curiosity, could you have just written that in plain text in the code and then just not include the source code when transferring to the Netlinx?
    TIMELINE_EVENT
    {
         IF PAYMENT_RECIEVED = 0
         {
             INITIATE ANNOYING REBOOT SEQUENCE
         }
         IF PAYMENT_RECIEVED = 1
         {
             TERMINATE ANNOYING REBOOT SEQUENCE
         }
    }
    

    or perhaps
         IF PAYMENT_RECIEVED = 0
         {
             set_outdoor_temperature(very_uncomfortable)
         }
         IF PAYMENT_RECIEVED = 1
         {
             set_outdoor_temperature(comfortable)
         }
    
    
  • mpullinmpullin Posts: 949
    The infamous set_outdoor_temperature() may not be the most appropriate here. Why make everyone ELSE pay for the client's lack of upkeep? -_-
  • AMXJeffAMXJeff Posts: 450
    Plus there is the whole global warming problem that setting outdoor_temperature is causing as well..
    mpullin wrote:
    The infamous set_outdoor_temperature() may not be the most appropriate here. Why make everyone ELSE pay for the client's lack of upkeep? -_-
Sign In or Register to comment.