RANDOM Command - formula
Oxalium7
Posts: 5
Does anyone know the exact formula used to generate the sequence of 16-bit pseudo-random numbers that RANDOM BASIC command generates? I need to create a PRNG (pseudo-random number generator) app on a PC that generates PRNs like the Stamp RANDOM command.
Project Scenario:
Stamp-based product that user pays upfront for fixed "usage" time slot. When payment is confirmed, user is given an "unlock" number. When time is up, user is again prompted for an unlock number. After user pays another fee, they will be given the next unlock number. This new number is generated internally with the Stamp BASIC RANDOM command.
The user is provided with the unlock numbers by customer service who use a PC app that generates the PRNs.
I should also mention that the first unlock number is stored in the Stamp-based product before it is shipped to the customer.
Project Scenario:
Stamp-based product that user pays upfront for fixed "usage" time slot. When payment is confirmed, user is given an "unlock" number. When time is up, user is again prompted for an unlock number. After user pays another fee, they will be given the next unlock number. This new number is generated internally with the Stamp BASIC RANDOM command.
The user is provided with the unlock numbers by customer service who use a PC app that generates the PRNs.
I should also mention that the first unlock number is stored in the Stamp-based product before it is shipped to the customer.
Comments
In VB2008 express you would use the Randomize() first some were in the Form_Load function and then Rnd functions in your formula.
-dan
-Phil
If space is not at a premium, using 65536 16-bit values would be fine ... as on a PC. The current pseudo-random number would be an index into the 65536-element table where the next pseudo-random number in the sequence would be found.
Some other systems with space constraints would probably have to use a PRNG rather than a table. Also, if one went to 32-bit or 64-bit based sequences ...
If I needed to quickly change the pseudo-random number generator parameters, I may not want to have to bother having to generate a table every time - I would just change the few parameters that control the PRNG
I just thought that someone out there might know what the Stamp BASICs PRNG parameters were.