<commit_before>#!/usr/bin/env pypy

import simuvex

import itertools
rand_count = itertools.count()

class random(simuvex.SimProcedure):
    #pylint:disable=arguments-differ

    def run(self, buf, count, rnd_bytes):
        # return code
        r = self.state.se.ite_cases((
                (self.state.cgc.addr_invalid(buf), self.state.cgc.EFAULT),
                (self.state.se.And(rnd_bytes != 0, self.state.cgc.addr_invalid(rnd_bytes)), self.state.cgc.EFAULT),
            ), self.state.se.BVV(0, self.state.arch.bits))

        if self.state.satisfiable(extra_constraints=[count!=0]):
            self.state.memory.store(buf, self.state.BVV("A" * self.state.se.any_int(count)), size=count)
        self.state.memory.store(rnd_bytes, count, endness='Iend_LE', condition=rnd_bytes != 0)

        return r

cgc_simprocedures = [("random", random)]
<commit_msg>use max_int instead of any_int in `random`<commit_after>#!/usr/bin/env pypy

import simuvex

import itertools
rand_count = itertools.count()

class random(simuvex.SimProcedure):
    #pylint:disable=arguments-differ

    def run(self, buf, count, rnd_bytes):
        # return code
        r = self.state.se.ite_cases((
                (self.state.cgc.addr_invalid(buf), self.state.cgc.EFAULT),
                (self.state.se.And(rnd_bytes != 0, self.state.cgc.addr_invalid(rnd_bytes)), self.state.cgc.EFAULT),
            ), self.state.se.BVV(0, self.state.arch.bits))

        if self.state.satisfiable(extra_constraints=[count!=0]):
            self.state.memory.store(buf, self.state.BVV("A" * self.state.se.max_int(count)), size=count)
        self.state.memory.store(rnd_bytes, count, endness='Iend_LE', condition=rnd_bytes != 0)

        return r

cgc_simprocedures = [("random", random)]

{'fraction_non_alphanumeric': 0.14781125639567935, 'fraction_numerical': 0.0045480386583285955, 'mean_word_length': 3.200477326968974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '3915554', 'n_tokens_mistral': 643, 'n_tokens_neox': 626, 'n_words': 94}