Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container">
  <h1>Lottery Verifier</h1>
    <div class="form-group">
      <label for="serverSeed">Server Seed</label>
      <input id="serverSeed" type="text" class="form-control">
    <div class="form-group">
      <label for="clientSeed">Client Seed</label>
      <input id="clientSeed" type="text"  class="form-control">
    <div class="form-group">
      <label for="nonce">Nonce</label>
      <input id="nonce" type="text" class="form-control">
    <div class="form-group">
      <label for="serverSeedHash">Server Seed (Hashed)</label>
      <input id="serverSeedHash" type="text" class="form-control" disabled>
    <div class="form-group">
      <label for="numbers">Numbers</label>
      <input id="numbers" type="text" class="form-control" disabled>
    <div class="form-group">
      <label for="jackpotNumber">Jackpot Number</label>
      <input id="jackpotNumber" type="text" class="form-control" disabled>




                var url = $.url(document.location.href);
var minNumber = parseInt(url.param('minNumber') || '1', 10)
var maxNumber = parseInt(url.param('maxNumber') || '36', 10)
var minJackpotNumber = parseInt(url.param('minJackpotNumber') || '1', 10)
var maxJackpotNumber = parseInt(url.param('maxJackpotNumber') || '10', 10)

function getNumber(serverSeed, clientSeed, nonce, min, max) {
  var hash = sha512(serverSeed + clientSeed + nonce);
  var chunkLength = 3;
  var maxChunkNum = 16 ** chunkLength;
  var upperBoundary = maxChunkNum - (maxChunkNum % max);

  var index = 0;
  do {
    var lucky = parseInt(hash.substr(index, chunkLength), 16);
    index += chunkLength;
  } while (lucky > upperBoundary);
  return min + (lucky % (max - min + 1));

function getNumbers(serverSeed, clientSeed, currentNonce, maxNonce, min, max) {
  var numbers = [];
  while (currentNonce <= maxNonce) {
    var number = getNumber(serverSeed, clientSeed, currentNonce++, min, max);
    if (-1 === numbers.indexOf(number)) {
  return numbers;

var $serverSeed = $('#serverSeed');
var $clientSeed = $('#clientSeed');
var $nonce = $('#nonce');
var $serverSeedHash = $('#serverSeedHash');
var $numbers = $('#numbers');
var $jackpotNumber = $('#jackpotNumber');


$('form').keyup(function() {
  var serverSeed = $serverSeed.val();
  var clientSeed = $clientSeed.val();
  var nonce = $nonce.val();

  $serverSeedHash.val(serverSeed ? sha256(serverSeed) : '<Empty Server Seed>');
  if (!serverSeed) {
    $numbers.val('<Empty Server Seed>');
    $jackpotNumber.val('<Empty Server Seed>');
  } else if (!clientSeed) {
    $numbers.val('<Empty Client Seed>');
    $jackpotNumber.val('<Empty Client Seed>');
  } else if (nonce === '') {
    $numbers.val('<Empty Nonce>');
    $jackpotNumber.val('<Empty Nonce>');
  } else {
    $numbers.val(getNumbers(serverSeed, clientSeed, 1, nonce - 1, minNumber, maxNumber).join(', '));
    $jackpotNumber.val(getNumbers(serverSeed, clientSeed, nonce, nonce, minJackpotNumber, maxJackpotNumber).join(', '));