Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- App.controller('mechanicsController', function($scope) {
- $scope.rolld6 = function() {
- $scope.d6 = [];
- do {
- var roll = Math.floor((Math.random() * 6) + 1);
- $scope.d6.push(roll);
- }
- while (roll === 6);
- var sum6 = $scope.d6.reduce(function(pv, cv) {
- return pv + cv;
- }, 0);
- $scope.d6total = sum6;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement