Skip to content

Need check-random-within #88

Closed

Description

@samth

Consider the following function:

Exercise 4 Design a function between that takes two Posns as input and returns a Posn that is almost their midpoint, but randomly moved a little bit. The distance of random movement must be proportional to the distance between the two inputs, so use (drift (* 0.2 (dist ... ...))) twice, once to move the x coordinate and once to move the y coordinate. Here dist is from Assignment 6. So use dist, drift, and midpoint. For testing, remember to use check-random.

This is taken from https://cs.indiana.edu/classes/c211/lab14.html

Testing this function requires check-random, but if the tested Posns don't form a pythagorean triple, then you end up with inexact numbers and check-random refuses to compare. Similarly, you can't use check-within because it doesn't do randomness determinization.

I plan to write a PR to fix this.

Activity

  1. mfelleisen commented on Dec 10, 2019

    @mfelleisen
    Contributor

    For the record, the proper English is

    "Design the function between, which takes two .." (and the comma should be type-set in code mode :-)

  2. linked a pull request that will close this issuecheck-random-within #95on Oct 7, 2026
  3. shhyou commented on Oct 7, 2026

    @shhyou
    Collaborator

    Completed by @samth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions