<jupyter_start><jupyter_text>Random Values Example  An example use case for random values This example shows how to **initialize** a tf Variable from calling a random function.It also shows how to **join related tensors** for convenience in accessing similar elements<jupyter_code>import tensorflow as tf
scores = tf.Variable(tf.random.uniform(shape=(5, 1), maxval=10, dtype=tf.int32))
time = tf.Variable(tf.random.uniform(shape=(5, 1), minval=1, maxval=60, dtype=tf.int32))
reward = tf.abs(scores - time)
print(scores)
print(time)
print(reward)<jupyter_output><tf.Variable 'Variable:0' shape=(5, 1) dtype=int32, numpy=
array([[0],
       [1],
       [9],
       [3],
       [2]], dtype=int32)>
<tf.Variable 'Variable:0' shape=(5, 1) dtype=int32, numpy=
array([[24],
       [50],
       [34],
       [25],
       [ 8]], dtype=int32)>
tf.Tensor(
[[24]
 [49]
 [25]
 [22]
 [ 6]], shape=(5, 1), dtype=int32)<jupyter_text>We have the 3 tensors:        scores,        the time it took to score,        and the reward for that score         Let's join them to form a single tensor<jupyter_code>game_results = tf.concat(values=(scores, time, reward), axis=1)
print(game_results)
# We can now access the reward and the time in took to make a certain score
# Example for the first score

score1 = game_results[0].numpy()
print(f'First Score: {score1[0]}\n')
print(f'Time taken:{score1[1]}, reward: {score1[2]}')<jupyter_output>First Score: 0

Time taken:24, reward: 24
{'fraction_non_alphanumeric': 0.14540466392318244, 'fraction_numerical': 0.047325102880658436, 'mean_word_length': 4.324817518248175, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '61272', 'license': 'MIT', 'n_tokens_mistral': 535, 'n_tokens_neox': 492, 'n_words': 155, 'path': 'notebooks/1 intro_to_tensorflow/1.8 example_random.ipynb', 'repo_name': 'hogum/tf2', 'size': '1458'}