Langertha/Role/Seed.pm

filter: Statementstmt 91.6% 11 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 88.2% 15 / 17 CC 1 SCAR 2.2
CC
1
Cov
92%
random_seed
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Langertha/Role/JSON.pm ↑ Summary Langertha/Output.pm »
1 package Langertha::Role::Seed;
2 # ABSTRACT: Role for an engine that can set a seed
3 12 our $VERSION = '0.502';
4 12 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 12 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 12 has randomize_seed => (
8 is => 'ro',
9 lazy_build => 1,
10 );
11 5 ▶sub _build_randomize_seed { 0 }
Subroutine _build_randomize_seed: called CC=1 SCAR=0.0
12  
13  
14 12 has seed => (
15 is => 'ro',
16 predicate => 'has_seed',
17 );
18  
19  
20 sub random_seed {
21 0 ▶ return sprintf("%u",rand(100_000_000));
Subroutine random_seed: not called CC=1 SCAR=6.9
Pod documented
22 }
23  
24  
25  
26 12 1;
27  
28 __END__
29  
30 =pod
31  
32 =encoding UTF-8
33  
34 =head1 NAME
35  
36 Langertha::Role::Seed - Role for an engine that can set a seed
37  
38 =head1 VERSION
39  
40 version 0.502
41  
42 =head2 randomize_seed
43  
44 When true, a random seed is generated for each request. Defaults to C<0>
45 (disabled). Useful when you want varied outputs without setting a fixed seed.
46  
47 =head2 seed
48  
49 Fixed integer seed for reproducible outputs. Optional. When set, the engine
50 passes it to the API to make sampling deterministic. Use C<randomize_seed>
51 instead when you want a different random seed on each call.
52  
53 =head2 random_seed
54  
55 my $seed = $engine->random_seed;
56  
57 Returns a random unsigned integer suitable for use as a seed value.
58  
59 =head1 SEE ALSO
60  
61 =over
62  
63 =item * L<Langertha::Role::Temperature> - Sampling temperature
64  
65 =item * L<Langertha::Engine::Ollama> - Engine that composes this role
66  
67 =back
68  
69 =head1 SUPPORT
70  
71 =head2 Issues
72  
73 Please report bugs and feature requests on GitHub at
74 L<https://github.com/Getty/langertha/issues>.
75  
76 =head2 IRC
77  
78 Join C<#langertha> on C<irc.perl.org> or message Getty directly.
79  
80 =head1 CONTRIBUTING
81  
82 Contributions are welcome! Please fork the repository and submit a pull request.
83  
84 =head1 AUTHOR
85  
86 Torsten Raudssus <getty@cpan.org>
87  
88 =head1 COPYRIGHT AND LICENSE
89  
90 This software is copyright (c) 2026 by Torsten Raudssus L<https://raudssus.de/>.
91  
92 This is free software; you can redistribute it and/or modify it under
93 the same terms as the Perl 5 programming language system itself.
94  
95 =cut
« Langertha/Role/JSON.pm ↑ Summary Langertha/Output.pm »