code: def generate_plaintext_random(
      plain_vocab, distribution, train_samples, length
  ):
      """Generates samples of text from the provided vocabulary.
  
      Args:
        plain_vocab: vocabulary.
        distribution: distribution.
        train_samples: samples for training.
        length: length.
  
      Returns:
        train_indices (np.array of Integers): random integers for training.
          shape = [num_samples, length]
        test_indices (np.array of Integers): random integers for testing.
          shape = [num_samples, length]
        plain_vocab   (list of Integers): unique vocabularies.
      """
      if distribution is not None:
          assert len(distribution) == len(plain_vocab)
  
      train_indices = np.random.choice(
          range(len(plain_vocab)),
          (train_samples, length),
          p=distribution,
      )
  
      return train_indices
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from collections import deque
  import numpy
  from tensor2tensor.data_generators import algorithmic
  from tensor2tensor.utils import registry
label_desc: Use image node_id 1 for calling a global function with example usage: generate_plaintext_random(plain_vocab, distribution, train_samples, length) and returns: train_indices