Thread: ISAAC pseudorandom number generator in JavaScript

Results 1 to 4 of 4
  1. #1 ISAAC pseudorandom number generator in TypeScript / JavaScript 
    Registered Member

    Join Date
    Feb 2009
    Age
    27
    Posts
    2,861
    Thanks given
    127
    Thanks received
    226
    Rep Power
    700
    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.

    Code:
    import { ISAACGenerator } from "isaac-crypto";
    
    const generator = new ISAACGenerator([ 1, 2, 3, 4 ]);
    
    generator.getNextResult(); // -621246914
    generator.getNextResult(); // 1957022519
    You can see the test cases used on on GitHub. (24 million results in total across 24 seeds.)
    Last edited by jameskmonger; 02-24-2023 at 12:57 AM.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Smokey's Avatar
    Join Date
    Apr 2011
    Posts
    287
    Thanks given
    124
    Thanks received
    73
    Rep Power
    351
    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..
    Spoiler for signature:

    He is richest who is content with the least, for contentment is the wealth of nature. - Socrates
    Attached image
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Feb 2009
    Age
    27
    Posts
    2,861
    Thanks given
    127
    Thanks received
    226
    Rep Power
    700
    Quote Originally Posted by Smokey View Post
    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
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Feb 2009
    Age
    27
    Posts
    2,861
    Thanks given
    127
    Thanks received
    226
    Rep Power
    700
    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.
    Reply With Quote  
     

  5. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [508/525]SteScape (NUMBER #1 IN FUN)
    By Stee in forum Advertise
    Replies: 5
    Last Post: 09-17-2010, 02:42 AM
  2. Java random number generator
    By Kenneh in forum Homework
    Replies: 16
    Last Post: 08-04-2010, 04:50 AM
  3. Dice roll(random number generator)
    By karl ownz u in forum Application Development
    Replies: 23
    Last Post: 05-13-2010, 10:34 PM
  4. Replies: 3
    Last Post: 02-15-2010, 12:46 PM
  5. Runescape post generator - IN PROGRESS
    By $_GET['life'] in forum Chat
    Replies: 6
    Last Post: 10-11-2009, 07:01 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •