Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the distribution of scaleLinear #405

Merged
merged 2 commits into from
Oct 8, 2020

Conversation

jonfowler
Copy link
Contributor

@jonfowler jonfowler commented Oct 8, 2020

scaleLinear currently only allows the largest value to be generated when at the maximum size 99:

> fmap (\sz -> scaleLinea sz 0 4) [0..99] :: [Integer]
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2
,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4]

This improves the distribution so each value is the max for an equal number of sizes:

> fmap (\sz -> scaleLinear sz 0 4) [0..99] :: [Integer]
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2
,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4]

@jonfowler jonfowler changed the title improve the distribution of scaleLinear Improve the distribution of scaleLinear Oct 8, 2020
Copy link
Member

@moodmosaic moodmosaic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 💯

@moodmosaic moodmosaic merged commit 06eb474 into hedgehogqa:master Oct 8, 2020
@moodmosaic
Copy link
Member

👍 Thank you, @jonfowler.

@jonfowler jonfowler deleted the improve-scalelinear branch October 8, 2020 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants