https://github.com/rubycon/isaac.js/...aster/isaac.js
>.>
nice tho, i implemented isaac in C++ and eventually created a smaller faster algorithm for a chat application I was writing at the time..
|
I have implemented the ISAAC random number generator algorithm (used in RuneScape) in JavaScript.
The source is written in TypeScript and can be seen on GitHub at Jameskmonger/isaac-crypto. The JavaScript is dsitributed on npm as isaac-crypto.
There are end-to-end integration tests around the library, and I used some of the code in daxxog's implementation as reference.
You can see the test cases used on on GitHub. (24 million results in total across 24 seeds.)Code:import { ISAACGenerator } from "isaac-crypto"; const generator = new ISAACGenerator([ 1, 2, 3, 4 ]); generator.getNextResult(); // -621246914 generator.getNextResult(); // 1957022519
Last edited by jameskmonger; 02-24-2023 at 12:57 AM.
https://github.com/rubycon/isaac.js/...aster/isaac.js
>.>
nice tho, i implemented isaac in C++ and eventually created a smaller faster algorithm for a chat application I was writing at the time..
I did stumble across that at some point but not only does it modify the String prototype but it also puts itself onto the global namespace. My implementation is written in TypeScript and exports itself using the commonjs pattern, as well as being fully unit tested. It's also available on npm which is a bit nicer to use with Node
Thanks to @Pazaz for reporting an issue when generating the 6th set of results (or higher). This was due to the lack of 32-bit integer overflows in JavaScript.
I have just published a release (v2.0.5) to fix this - you can see the commit here
I have also added test cases for 24 different seeds, testing the first 1 million generated results against a known-good Java implementation of ISAAC. You can see the commit for that change here.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |