<commit_before>#include "plumber.h"

int sporth_randi(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT out;
    SPFLOAT min;
    SPFLOAT max;
    SPFLOAT cps;
    sp_randi *randi;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "randi: Creating\n");
#endif

            sp_randi_create(&randi);
            plumber_add_ugen(pd, SPORTH_RANDI, randi);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "randi: Initialising\n");
#endif

            if(sporth_check_args(stack, "fff") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for randi\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            cps = sporth_stack_pop_float(stack);
            max = sporth_stack_pop_float(stack);
            min = sporth_stack_pop_float(stack);
            randi = pd->last->ud;
            sp_randi_init(pd->sp, randi);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            if(sporth_check_args(stack, "fff") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for randi\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            cps = sporth_stack_pop_float(stack);
            max = sporth_stack_pop_float(stack);
            min = sporth_stack_pop_float(stack);
            randi = pd->last->ud;
            randi->min = min;
            randi->max = max;
            randi->cps = cps;
            sp_randi_compute(pd->sp, randi, NULL, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            randi = pd->last->ud;
            sp_randi_destroy(&randi);
            break;
        default:
            fprintf(stderr, "randi: Uknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}
<commit_msg>fixed randi<commit_after>#include "plumber.h"

int sporth_randi(sporth_stack *stack, void *ud)
{
    plumber_data *pd = ud;
    SPFLOAT out;
    SPFLOAT min;
    SPFLOAT max;
    SPFLOAT cps;
    sp_randi *randi;

    switch(pd->mode) {
        case PLUMBER_CREATE:

#ifdef DEBUG_MODE
            fprintf(stderr, "randi: Creating\n");
#endif

            sp_randi_create(&randi);
            plumber_add_ugen(pd, SPORTH_RANDI, randi);
            if(sporth_check_args(stack, "fff") != SPORTH_OK) {
                fprintf(stderr,"Not enough arguments for randi\n");
                stack->error++;
                return PLUMBER_NOTOK;
            }
            cps = sporth_stack_pop_float(stack);
            max = sporth_stack_pop_float(stack);
            min = sporth_stack_pop_float(stack);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_INIT:

#ifdef DEBUG_MODE
            fprintf(stderr, "randi: Initialising\n");
#endif
            cps = sporth_stack_pop_float(stack);
            max = sporth_stack_pop_float(stack);
            min = sporth_stack_pop_float(stack);
            randi = pd->last->ud;
            sp_randi_init(pd->sp, randi);
            sporth_stack_push_float(stack, 0);
            break;
        case PLUMBER_COMPUTE:
            cps = sporth_stack_pop_float(stack);
            max = sporth_stack_pop_float(stack);
            min = sporth_stack_pop_float(stack);
            randi = pd->last->ud;
            randi->min = min;
            randi->max = max;
            randi->cps = cps;
            sp_randi_compute(pd->sp, randi, NULL, &out);
            sporth_stack_push_float(stack, out);
            break;
        case PLUMBER_DESTROY:
            randi = pd->last->ud;
            sp_randi_destroy(&randi);
            break;
        default:
            fprintf(stderr, "randi: Uknown mode!\n");
            break;
    }
    return PLUMBER_OK;
}

{'fraction_non_alphanumeric': 0.10469314079422383, 'fraction_numerical': 0.0007735946364105209, 'mean_word_length': 1.7987012987012987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 30, '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': '5165457', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1254, 'n_words': 226}