-
Notifications
You must be signed in to change notification settings - Fork 90
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
Change randomValue function to provide reaching of maximum value. #565
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fullset, thanks a lot for your huge efforts for issues!
Could we try to create a separate pull request just for randomBoolValue
function? I think such change is transparent with no debates. What do you think?
@@ -207,8 +207,8 @@ namespace image_function_cuda | |||
const std::vector < uint8_t > intensity = intensityArray( 2 ); | |||
PenguinV_Image::Image input = uniformImage( intensity[0], 0, 0, reference ); | |||
|
|||
const bool horizontalFlip = (randomValue<uint32_t>( 0, 2 ) == 0); | |||
const bool verticalFlip = (randomValue<uint32_t>( 0, 2 ) == 0); | |||
const bool horizontalFlip = ( randomValue<uint32_t>( 0, 1 ) == 0 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's create randomBoolValue() function instead. No harm to do this but it makes code easier to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this function we could use rand()
directly, no need to call randomValue<>
function
@@ -1935,8 +1935,8 @@ namespace Function_Template | |||
{ | |||
const std::vector < uint8_t > intensity = intensityArray( 2 ); | |||
PenguinV_Image::Image image = uniformImage( intensity[0] ); | |||
const uint32_t x = randomValue<uint32_t>( 0, image.width() ); | |||
const uint32_t y = randomValue<uint32_t>( 0, image.height() ); | |||
const uint32_t x = randomValue<uint32_t>( 0, image.width() - 1 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that this format is good as another developer would definitely forget to add - 1
. What's your opinion?
Closes #251
Hey, @ihhub look, please.
You've said in the description that 1 on the way to solve this issue is
So, I've changed the most of calls of
randomValue()
but some other calls look fine without changing.