Good tip, just also good to remember there's no way to control the seed of the generator, for example for a seeded world.
For that use case you still need to manually run the generator you created with your seed to select an item.
I think convenience methods like this are great, but making small little functions like this yourself can also be good exercises for beginner programmers.