code: def test_random():
      # test case: no seed
      algo = basic.Random()
      model = algo.fit(lktu.ml_test.ratings)
      items = lktu.ml_test.ratings["item"].unique()
      nitems = len(items)
  
      assert model is not None
  
      recs1 = algo.recommend(2038, 100)
      recs2 = algo.recommend(2028, 100)
      assert len(recs1) == 100
      assert len(recs2) == 100
      # with very high probabilities
      assert set(recs1["item"]) != set(recs2["item"])
  
      recs_all = algo.recommend(2038)
      assert len(recs_all) == nitems
      assert set(items) == set(recs_all["item"])
  
file_path: lkpy/tests/test_util_algos.py
imports: from lenskit.algorithms import basic
  import pandas
  import numpy
  import lenskit.util.test
label_desc: Use image node_id 6 for calling a global function with example usage: test_random() without return types