| |||||||
| Coding / Scripting / Programming Discussions on all manner of coding and scripting. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) | |
| Quote- "Wanna see me break the law with 1 line of code? Generation of random numbers by feeding the output of one random number generator into the input of another random number generator [#5,251,165] Now, are there any questions about why software patents need to be stopped?" What does this mean? | ||
| | | |
| Sponsored Links |
| | #2 (permalink) | |
| When a program generates random numbers, it typically uses a "seed" number to introduce the proper amount of entropy into the generation. A machine in inherently incapable of generating something completely random, as everything is based on some sort of code. The code just goes through a series of routines to generate the number. Most number generators will use the time of day in combination with the date to introduce the seed. The quote above refers to a patent on generating a random number using a previously generated random number as its seed. So in order to violate the patent, hence break the law, you could write a line of VB code (I'm most familiar with VB, if there are any C/C++ code monkeys around, feel free to toss in your own example) that looks like this: randomize randomize ***(1,15) ***(2,30) I know it's multiple lines, but I did that for readability. The actual quote refers to this (you use colons in VB to add multiple statements to one line): randomize:randomize ***(1,15):***(2,30) The first is needed to actually get the randomizer going so that the *** function will generate a random value between 1 and 15. The second line will then generate a second seed based on the outcome of the first random number. The third line uses the output of one random generator to generate a second, thereby breaking the patent. I used *** instead of the actual function so I wouldn't be breaking the law. | ||
| | | |