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

Repeater example #6545

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Repeater example #6545

wants to merge 2 commits into from

Conversation

NigelBreslaw
Copy link
Member

This intentionally has its own copy of the slint-logo as a lot of dead pixels were trimmed off the image so it will perform better.

@ogoffart
Copy link
Member

notice that the software renderer image embed already trim the dead pixel automatically.

Copy link
Member

@tronical tronical left a comment

Choose a reason for hiding this comment

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

Pretty cool :). Since this is an example and we invite folks to read the code, I've got one suggestion for the random number generator inside.

Comment on lines +33 to +36
// psuedo-random function
function random(seed: int) -> float {
return (115249 * (seed + 196) * seed).mod(25117) / 25117;
}
Copy link
Member

Choose a reason for hiding this comment

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

I think the seed is usually internal state to the random number generator. Would this work as well?

Suggested change
// psuedo-random function
function random(seed: int) -> float {
return (115249 * (seed + 196) * seed).mod(25117) / 25117;
}
property <int> seed: 42;
// pseudo-random function
function random() -> float {
seed = (115249 * (seed + 196) * seed).mod(25117);
return seed / 25117;
}

Copy link
Member

Choose a reason for hiding this comment

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

unfortunately, this won't compile because the function need to be pure.

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.

3 participants