EBoard 27: Randomness (Section 1)

Warning! You are being recorded and transcribed, provided the technology is working correctly.

Approximate optimistic overview

  • Quiz
  • Administrative stuff
  • Q&A
  • Lab

Administrative stuff

Introductory notes

  • For clarity, here are the kinds of help you can obtain.
    • If you don’t understand a topic, you can (a) attend mentor sessions, (b) sign up for a meeting with Sam, (c) TM Sam, (d) ask for an individual tutor (if this is a recurring issue and you’re attending mentor sessions). You can also (e) ask the evening tutors if they are not busy.
    • If you need help with a mini-project, you can (a) ask the evening tutors, (b) TM Sam, (c) sign up for a meeting with Sam. (d) ask in class (provided it’s a general question). Individual tutors are not supposed to be for homework help!
    • You can also ask a fellow student about these issues (except on LAs).

Upcoming activities

Scholarly

  • Wednesday, 9 April 2025, 4:15–5:15 p.m., Noyce 2022. Building Trust in the Digital Age: Privacy-Preserving Security for Networks and Location-Based Systems
  • Thursday, 10 April 2025, 11am–noon, HSSC A1231. Scholars’ Convocation: Jen Shook: Instead of RedFace: Relational Trails in “Indian Country,” Onstage, Online, and IRL
  • Thursday, 10 April 2025, 4:00–5:30pm, the Kernel (HSSC Multipurpose Room). CS Poster Session
  • Tuesday, 15 April 2025, noon–1pm, Some PDR. CS Table: ???

Artistic

  • Thursday, 10 April 2025, 7:00 p.m., Herrick Chapel. Klezmer band Upshtat Zingerai.

Multicultural

  • Wednesday, 9 April 2025, 4:30 p.m., Bucksbaum 154. Klezmer Workshop.
    • Learn to dance a Hora, a Bulgar, a Cosidle, or a Freylekhe.
  • Friday, 11 April 2025, 4:00–5:00 p.m., HSSC N1170 (Global Living Room). Middle of Everywhere: Sindhi community in Pakistan

Artistic / Multicultural

  • Thursday, 10 April 2025, 7:00–9:00 p.m., HSSC A2231. Superfest Disability Film Festival: Opening
  • Saturday, 12 April 2025, 10:30–11:30 a.m., Drake Library. Superfest Disability Film Festival: Family-Friendly Shorts
  • Saturday, 12 April 2025, 10:00 a.m.–noon, HSSC A2231. Superfest Disability Film Festival: Feature Film
  • Saturday, 12 April 2025, 1:30 p.m.–3:45 p.m., HSSC A2231. Superfest Disability Film Festival: Chronic Pain Shorts
  • Sunday, 12 April 2025, 10:00 a.m.–noon, HSSC A2231. Superfest Disability Film Festival: Feature Film
  • Sunday, 12 April 2025, 1:30 p.m.–3:45 p.m., HSSC A2231. Superfest Disability Film Festival: Assorted Shorts and Panel

Peer

Musical, theatric, sporting, and academic events involving this section’s students are welcome.

  • Read articles by your fellow CSC-151 students and comment on them online.
  • Track and Field Home Meet this weekend.

Wellness

  • Thursday, 10 April 2025. ???. ???. Forest Bathing.
  • Friday, 11 April 2025, 6:00 p.m.–8:00 p.m., Aux Gym. Badminton Club (Smash that bird!)
  • Friday, 11 April 2025, 9:00 p.m., Noyce Elbow. Nerf at Noyce.
  • Saturday, 12 April 2025, 4:00 p.m.–6:00 p.m., Aux Gym. Badminton Club (Smash that bird!)
  • Tuesday, 15 April 2025, 5:00–6:00 p.m., HSSC Atrium. Therapy Dogs.
  • Tuesday, 15 April 2025, 7:15–8:15 p.m., HSSC Atrium. Therapy Dogs.
  • Tuesday, 15 April 2025, 12:15–12:50 p.m., GCMoA. Yoga in the Museum.
  • Tuesday, 15 April 2025, 4:30–6:30 p.m., BRAC P103 (Multipurpose Dance Studio). Wellness Yoga.

Misc

  • Wednesday, 9 April 2025, Noon–1:00 p.m., HSSC A2231 (Auditorium) Community Forum
    • “Weekly discussion on legal protections and recourse on issues that higher education and Grinnell College face.”
    • Also online.
    • This week: Karen Edwards on Immigration Regulations.
  • Sunday, 15 April 2025, 7:30–8:30 p.m., Science 3819. Mentor Session: SoLA 3
  • Tuesday, 15 April 2025, 7:00–8:00 p.m., Science 3820. Mentor Session: Dictionaries

Other good things

These do not earn tokens, but are worth your consideration.

Upcoming work

Questions

Administrative

Mini-project 7

Randomness

Please read over these on your own.

Will we use this procedure on any upcoming mini projects?

Probably MP8.

Expand on why random is useful in other procedures.

Random is generally useful when we want to simulate things. As we’ll see in lab, it can also be useful for some “fun” things.

Random returns an integer, but each integer in the ‘returnable’ range of the given parameter for random has an equal chance of returning. How could you alter this chance? Say you had (random 5) but you wanted 1 to have an 80% less chance to return than the rest of the integers?

You can’t change the behavior of random. But you can write procedures that provide different distributions. For example, we could build a vector of the possible values, each in the proportion we want, and randomly select from that vector.

(define biased-random
  (let* ([vals (vector 0 0 0 0 0 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4)]
         [valslen (vector-length vals)])
    (lambda ()
      (vector-ref vals (random valslen)))))

How does it work that (+ (random 6) 1) increases the range to 6?

It doesn’t. It increases the upper-bound of the range to 6, but it also increases the lower bound of the range to 1. The largest number (random 6) can produce is 5. If we add 1 to 5, we get 6. The smallest number (random 6) can produce is 0. If we add 1 to 0, we get 1.

What’s a pseudo-random generator?

It’s an algorithm for generating random numbers. Since it’s an algorithm, it’s officially “predictable”. However, it produces values in something close to a random distribution.

What’s so special about the number 4,294,967,296?

It’s (expt 2 32), the largest number you can represent with 32 bits. Where did you see it?

Lab

Side note: This is one of my favorite labs because (a) there’s a really bad pun in the lab and (b) the “Rolling Rolling Rolling” reminds me of two of my favorite performances (John Belushi and band performing “Rawhide” in The Blues Brothers and any of the many Tina Turner performances of “Proud Mary”.)