code: def random_dataset(
      nrow,
      ncol,
      realFrac=0.4,
      intFrac=0.3,
      enumFrac=0.3,
      factorR=10,
      integerR=100,
      responseFactor=1,
      misFrac=0.01,
      randSeed=None,
  ):
      fractions = dict()
      if (ncol == 1) and (realFrac >= 1.0):
          fractions[
              "real_fraction"
          ] = 1  # Right now we are dropping string columns, so no point in having them.
          fractions["categorical_fraction"] = 0
          fractions["integer_fraction"] = 0
          fractions["time_fraction"] = 0
          fractions[
              "string_fraction"
          ] = 0  # Right now we are dropping string columns, so no point in having them.
          fractions["binary_fraction"] = 0
  
          return h2o.create_frame(
              rows=nrow,
              cols=ncol,
              missing_fraction=misFrac,
              has_response=True,
              response_factors=responseFactor,
              integer_range=integerR,
              seed=randSeed,
              **fractions,
          )
  
      real_part = pyunit_utils.random_dataset_real_only(
          nrow,
          (int)(realFrac * ncol),
          misFrac=misFrac,
          randSeed=randSeed,
      )
      cnames = ["c_" + str(ind) for ind in range(real_part.ncol)]
      real_part.set_names(cnames)
      enumFrac = enumFrac + (1 - realFrac) / 2
      intFrac = 1 - enumFrac
      fractions[
          "real_fraction"
      ] = 0  # Right now we are dropping string columns, so no point in having them.
      fractions["categorical_fraction"] = enumFrac
      fractions["integer_fraction"] = intFrac
      fractions["time_fraction"] = 0
      fractions[
          "string_fraction"
      ] = 0  # Right now we are dropping string columns, so no point in having them.
      fractions["binary_fraction"] = 0
  
      df = h2o.create_frame(
          rows=nrow,
          cols=(ncol - real_part.ncol),
          missing_fraction=misFrac,
          has_response=True,
          response_factors=responseFactor,
          integer_range=integerR,
          seed=randSeed,
          **fractions,
      )
      return real_part.cbind(df)
  
file_path: h2o-3/h2o-py/tests/testdir_algos/gam/pyunit_generate_synthetic_GAM_data.py
imports: import sys
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator
  from random import random
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: random_dataset(nrow, ncol, realFrac, intFrac, enumFrac, factorR, integerR, responseFactor, misFrac, randSeed) and returns: real_part, h2o