Skip to content

CHANGE: Increase correctness of angle example in the documentation #1837

Description

@Neovimproved

Summary

Just a minor discrepancy in the documentation that needs fixing (it says degrees but the angle uses the range -pi..pi)

Details

Changing the print message of the example (degrees should be radians)
Current:

// Ranged sampling:
use std::f32::consts::PI;
println!("Angle: {} degrees", rand::random_range(-PI..PI));

Revised:

// Ranged sampling:
use std::f32::consts::PI;
println!("Angle: {} radians", rand::random_range(-PI..PI));

Note: I created this issue before but it was closed since I failed to mention the location of this documentation. I initially saw it on the docs.rs documentation, https://docs.rs/rand/latest/rand/. In the code it is line 22 of src/lib.rs

Motivation

It's a mistake in the documentation that makes it look unpolished.

Alternatives

Not changing it. I guess it's easier in the short term but there might be more people like me in the future wondering why it says degrees and not radians.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions