Implemented generateA function.