Smart Random Number Generator In jQuery - MemoryRoll

Smart Random Number Generator In jQuery - MemoryRoll
File Size: 62.7 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

MemoryRoll is a smart Random Number Generator build with jQuery that generates random numbers within a min/max range you provide, and saves the generated value in the browser local storage.

The generator detects if there is a value has been saved in the local storage and then generates the next number related to the saved value.

See Also:

How to use it:

1. Download and load the MemoryRoll plugin's script after jQuery.

<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"        
        integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"
        crossorigin="anonymous">
</script>
<script src="dist/js/jquery.memoryroll.js"></script>

2. The JavaScript to generate a new random number.

var number = $.memoryroll({

    // required name used for local storage
    name: 'demo'

});

3. Determine the min/max range as follows:

var number = $.memoryroll({
    
    name: 'demo',
    rangeFrom: 1,
    rangeTo: 10

});

This awesome jQuery plugin is developed by martinmethod. For more Advanced Usages, please check the demo page or visit the official website.