O'Reilly logo

Digital Dice by Paul J. Nahin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

image

image

11. The Case of the Missing Senators

The code missing.m simulates the problem of the absentee senators. Lines 01 and 02 are by now obvious to you. Line 03 initializes the variable defeats to zero; the value of this variable, at the end of the program execution, will be how many times the bill was defeated during one million simulated votes. Lines 04 and 26 define the for/end loop that cycles the code through its one million simulations. Line 05 defines the 100-element row vector votes; votes(k) is the vote during an individual simulation of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required