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

Clarify that RandomFiller uses one random number #719

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adoc/chapters/programming_interface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17177,7 +17177,7 @@ If the [code]#operator()# function writes to any of the member variables, the
behavior is undefined.

The following example defines a <<sycl-kernel-function>>, _RandomFiller_, which
initializes a buffer with a random number.
initializes all elements of a buffer with the same random number.
The random number is generated during the construction of the function object
while processing the command group.
The [code]#operator()# member function of the function object receives an
Expand Down
3 changes: 1 addition & 2 deletions adoc/code/myfunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class RandomFiller {
std::uniform_int_distribution<> r { 1, 100 };
randomNum_ = r(hwRand);
}
void operator()(item<1> item) const { ptr_[item.get_id()] = get_random(); }
int get_random() const { return randomNum_; }
void operator()(item<1> item) const { ptr_[item.get_id()] = randomNum_; }

private:
accessor<int> ptr_;
Expand Down