af_get_default_random_engine() returns a handle to a thread_local RandomEngine object. From what I understand of the implementation, calling af_release_random_engine() would delete the RandomEngine, and any future call to af_get_default_random_engine() would then return the same handle, which is now dangling (references a deleted object).
In fact, whenever af_get_default_random_engine() is used internally in ArrayFire, I see that af_release_random_engine() is never called. Likewise, the C++ API actually makes a copy of the returned handle, so the original default engine doesn't get deleted.
If this is intended, it may be worth mentioning this special case in the documentation of either af_get_default_random_engine() or af_get_default_random_engine() (or both).
af_get_default_random_engine()returns a handle to athread_localRandomEngineobject. From what I understand of the implementation, callingaf_release_random_engine()would delete theRandomEngine, and any future call toaf_get_default_random_engine()would then return the same handle, which is now dangling (references a deleted object).In fact, whenever
af_get_default_random_engine()is used internally in ArrayFire, I see thataf_release_random_engine()is never called. Likewise, the C++ API actually makes a copy of the returned handle, so the original default engine doesn't get deleted.If this is intended, it may be worth mentioning this special case in the documentation of either
af_get_default_random_engine()oraf_get_default_random_engine()(or both).