keras/src/layers/preprocessing/random_contrast.py/RandomContrast/call
class RandomContrast:    def call(self, inputs, training=True):
        inputs = self.backend.cast(inputs, self.compute_dtype)
        if training:
            seed_generator = self._get_seed_generator(self.backend._backend)
            factor = self.backend.random.uniform(
                shape=(),
                minval=1.0 - self.lower,
                maxval=1.0 + self.upper,
                seed=seed_generator,
                dtype=self.compute_dtype,
            )

            outputs = self._adjust_constrast(inputs, factor)
            outputs = self.backend.numpy.clip(outputs, 0, 255)
            self.backend.numpy.reshape(outputs, self.backend.shape(inputs))
            return outputs
        else:
            return inputs