Simple.js 690 B

123456789101112131415161718192021222324
  1. define("dojox/math/random/Simple", ["dojo"], function(dojo) {
  2. return dojo.declare("dojox.math.random.Simple", null, {
  3. // summary:
  4. // Super simple implementation of a random number generator,
  5. // which relies on Math.random().
  6. destroy: function(){
  7. // summary:
  8. // Prepares the object for GC. (empty in this case)
  9. },
  10. nextBytes: function(/* Array */ byteArray){
  11. // summary:
  12. // Fills in an array of bytes with random numbers
  13. // byteArray: Array:
  14. // array to be filled in with random numbers, only existing
  15. // elements will be filled.
  16. for(var i = 0, l = byteArray.length; i < l; ++i){
  17. byteArray[i] = Math.floor(256 * Math.random());
  18. }
  19. }
  20. });
  21. });