Week 6 Notes
Week 6 Notes CS 1110-002
Popular in Intro to Computing using Python
verified elite notetaker
Popular in ComputerScienence
This 1 page Class Notes was uploaded by Eunice on Saturday March 5, 2016. The Class Notes belongs to CS 1110-002 at Cornell University taught by Lee, Van Loan in Spring 2016. Since its upload, it has received 15 views. For similar materials see Intro to Computing using Python in ComputerScienence at Cornell University.
Reviews for Week 6 Notes
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 03/05/16
CS 1110 Van Loan and Lee Spring 2016 March 1, 2016 random simulations o random in cs: means no discernable pattern o dart ex. 4:pi::the number of dart throws:hits o random Module random.randint(a,b) gives back a random integer between a and b, including a and b renaming a function o “from random import randint as randi” o after this, refer to random.randint(a,b) as randi(a,b) random.uniform(a,b) random floats random.normalvariate(mu,sigma) o short cut x += 1 same as x = x + 1 o repeatability of experiments random.seed reset the algorithmic process and fix the random generation process’s start point o having the same start point means that the same random sequence will be applied and the simulation can be repeated March 3, 2016 iteration: the while-loop open-ended iteration: o do a certain execution until a certain characteristic/event appears o “[code that comes before the loop] o while [a Boolean expression]: [the loop body] o [code that comes after the loop]” see slides for examples of while loop
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'