Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. App.controller('mechanicsController', function($scope) {
  2.  
  3.   $scope.rolld6 = function() {
  4.     $scope.d6 = [];
  5.     do {
  6.       var roll = Math.floor((Math.random() * 6) + 1);
  7.       $scope.d6.push(roll);
  8.     }
  9.     while (roll === 6);
  10.     var sum6 = $scope.d6.reduce(function(pv, cv) {
  11.       return pv + cv;
  12.     }, 0);
  13.     $scope.d6total = sum6;
  14.   };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement