Are Random Forests trained with the whole dataset? I was reading "Hands On Machine Learning" by Aurelien Geron, and the following text appeared:

As we have discussed, a Random Forest is an ensemble of Decision
Trees, generally trained via the bagging method (or sometimes
pasting), typically with max_samples set to the size of the training
set.

The max_samples argument defines how many elements of the data set go into each model trained, in this case, to the Decision Tree Classifiers. My question is, how does this make sense? Because in theory, if we passed the whole training set to each individual model, wouldn't all the models be exactly the same? Wouldn't it make more sense to train each model with a random part of the data set, in order to get completely different classifiers each time? So it can accurately do predictions.
This is how you would create a Random Forest:
from sklearn.ensemble import BaggingClassifier
from sklearn.tree import DecisionTreeClassifier

bagging_classifier = BaggingClassifier(
  base_estimator = DecisionTreeClassifier(), # Model to use
  n_estimators=500, # Number of models to train
  max_samples=100, # Amount of samples to train each model (Putting the length of the whole dataset is what he's proposing)
)


All previous answers are correct.
I would like just to clarify one point of your question:

My question is, how does this make sense? Because in theory, if we passed the whole training set to each individual model, wouldn't all the models be exactly the same?

As you have seen in previous answers, we are doing Bootstrapping, so the weak decision trees we are creating are going to be different since they have different dataset.
But, imagine you set the bootstrap=False. Will you obtain the same week trees since you have the same dataset? The answer is NO.
Why? Because Random Forest selects also randomly some features to create every decision tree. So, you will have same dataset, but different features you are playing with.
The hyperparameter to tune this idea is called max_features.
