mathrandom.js 636 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright 2018 Scytl Secure Electronic Voting SA
  3. *
  4. * All rights reserved
  5. *
  6. * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
  7. */
  8. /* jshint node:true */
  9. 'use strict';
  10. module.exports = MathRandomCollector;
  11. var collectEntropy_ = function() {};
  12. function MathRandomCollector(collectEntropyCallback) {
  13. collectEntropy_ = collectEntropyCallback;
  14. }
  15. MathRandomCollector.prototype = {
  16. startCollector: function() {
  17. collectEntropy_(Math.random(), 0);
  18. },
  19. stopCollector: function() {
  20. // just executed once, so no need to execute anything else
  21. return true;
  22. }
  23. };