code: def random_train_test_split(
      interactions, test_percentage=0.2, random_state=None
  ):
      """
      Randomly split interactions between training and testing.
  
      Parameters
      ----------
  
      interactions: :class:`spotlight.interactions.Interactions`
          The interactions to shuffle.
      test_percentage: float, optional
          The fraction of interactions to place in the test set.
      random_state: np.random.RandomState, optional
          The random state used for the shuffle.
  
      Returns
      -------
  
      (train, test): (:class:`spotlight.interactions.Interactions`,
                      :class:`spotlight.interactions.Interactions`)
           A tuple of (train data, test data)
      """
  
      interactions = shuffle_interactions(
          interactions, random_state=random_state
      )
  
      cutoff = int((1.0 - test_percentage) * len(interactions))
  
      train_idx = slice(None, cutoff)
      test_idx = slice(cutoff, None)
  
      train = Interactions(
          interactions.user_ids[train_idx],
          interactions.item_ids[train_idx],
          ratings=_index_or_none(interactions.ratings, train_idx),
          timestamps=_index_or_none(interactions.timestamps, train_idx),
          weights=_index_or_none(interactions.weights, train_idx),
          num_users=interactions.num_users,
          num_items=interactions.num_items,
      )
      test = Interactions(
          interactions.user_ids[test_idx],
          interactions.item_ids[test_idx],
          ratings=_index_or_none(interactions.ratings, test_idx),
          timestamps=_index_or_none(interactions.timestamps, test_idx),
          weights=_index_or_none(interactions.weights, test_idx),
          num_users=interactions.num_users,
          num_items=interactions.num_items,
      )
  
      return train, test
  
imports: import numpy
  from sklearn.utils import murmurhash3_32
  from spotlight.interactions import Interactions
label_desc: Use image node_id 3 for calling a global function with example usage: random_train_test_split(interactions, test_percentage, random_state) and returns: train,  test