<commit_before>% example:
% lcq(gnu, LCQ), length(L, 5), L ins 0..9, L = [5|_], randseq(LCQ, L).

:- module(randseq,
          [randseq/2,
           lcq/2]
         ).

:- use_module(library(clpfd)).

lcq(gnu, lcq(1103515245, 12345, 4294967296)).

randseq(LCQ, L) :-

   LCQ = lcq(_, _, M),
   randseq(LCQ, L, S),
   Max is M - 1,
   S ins 0..Max,
   label(S).

randseq(_, [], []) :- !.

randseq(_, [X], [Seed]) :-

   norm(Seed, X), !.

randseq(LCQ, [X|L], [Seed|S]) :-

   S = [Seed1|_],
   norm(Seed, X),
   lcq_eval(LCQ, Seed, Seed1),
   randseq(LCQ, L, S).

lcq_eval(lcq(A, C, M), X0, X) :-

   X #= (A * X0 + C) mod M.

% map Seed to X domain
norm(Seed, X) :-
   fd_inf(X, Min),
   fd_sup(X, Max),
   X #= Seed mod (Max - Min + 1) + Min.

   <commit_msg>randseq/2 -> randseq/3 (seed is labelled out of predicate).<commit_after>% example:
% lcq(gnu, LCQ), length(L, 5), L ins 1..100, randseq(LCQ, L, S), repeat, X0 is random(100), L=[X0|_], label(S), !, atom_codes(A, L).

:- module(randseq,
          [randseq/3,
           lcq/2]
         ).

:- use_module(library(clpfd)).

lcq(gnu, lcq(1103515245, 12345, 4294967296)).

randseq(LCQ, L, S) :-

   LCQ = lcq(_, _, M),
   randseq2(LCQ, L, S),
   Max is M - 1,
   S ins 0..Max.

randseq2(_, [], []) :- !.

randseq2(_, [X], [Seed]) :-

   norm(Seed, X), !.

randseq2(LCQ, [X|L], [Seed|S]) :-

   S = [Seed1|_],
   norm(Seed, X),
   lcq_eval(LCQ, Seed, Seed1),
   randseq2(LCQ, L, S).

lcq_eval(lcq(A, C, M), X0, X) :-

   X #= (A * X0 + C) mod M.

% map Seed to X domain
norm(Seed, X) :-
   fd_inf(X, Min),
   fd_sup(X, Max),
   X #= Seed mod (Max - Min + 1) + Min.

   
{'fraction_non_alphanumeric': 0.22584615384615384, 'fraction_numerical': 0.05476923076923077, 'mean_word_length': 2.4522292993630574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2450369', 'n_tokens_mistral': 855, 'n_tokens_neox': 774, 'n_words': 184}