![]() R: R has functions like `set.seed` to control the randomness and make it deterministic.ġ0. Julia: Julia provides a `ed!` function to set the seed for deterministic randomness.ĩ. Ruby: Ruby's `Kernel.rand` method can be seeded for deterministic random numbers.Ĩ. MATLAB: MATLAB's `rand` function can be made deterministic by setting the seed with `rng`.ħ. JavaScript: In browsers and Node.js, the `Math.random` function can be overridden to make it deterministic.Ħ. C#: C# offers the `System.Random` class, which can be seeded for deterministic randomness.ĥ. C++: The C++ Standard Library provides functions like `srand` and `rand` that can be used for deterministic random number generation when seeded.Ĥ. Java: Java's `Random` class can be seeded to produce deterministic random sequences.ģ. Python: The `random` module can be seeded to produce deterministic random sequences.Ģ. Here are some programming languages and methods that allow for deterministic random number generation:ġ. The real wtf was that this was perl on win98, probably due to when it was implemented, they wanted dvd burning capability and someone sort of knew perl.ĭeterministic random number generation, where the same seed produces the same sequence of random numbers, can be achieved in various programming languages through different methods or libraries. random(seed) is an artifact of implementation and should never be used for deterministic output. random is for non-deterministic output, hash is for deterministic output. The lesson I learned, don't use random() when you want hash(). They ended up having to make sure they went back to the same system the key was generated on then regenerate and store all keys used. ![]() and sometime even changing the version of perl was enough. Young me was like "well I don't know much about perl but I don't think there is any documentation guarantee about how exactly the rand(seed) function works." a few quick tests later and I found out that yes rand(seed) will return different values from different operating systems. The worrisome part was that they were using perl's rand(seed) as a hash function. They would then regenerate the key if the data ever needed to be retrieved. ![]() One thing I found out is that they were generating the encryption keys by combining a couple of values(something like secret + date I think) then hashing. but long nights between shuffling tapes and swapping dvd I would try and figure out how the system worked. I was a lowly tape monkey at the time so the actual details of the application were far above my pay grade. Not java but a company I worked for had a perl application where old sales records were encrypted then put on dvd's for long term cold storage.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |