Test::S...n::SRand(3)
π Test::Stream::Plugin::SRand β the perl manual page (section 3, user contributed perl documentation, bestie) π
okay so first things first, this is the page for Test::Stream::Plugin::SRand and it lives in section 3 of the perl manual, the User Contributed Perl Documentation zone. yes you're in the right place. π
β¨ NAME β¨
Test::Stream::Plugin::SRand β control the random seed so your test environments stop doing whatever they want. π²
π¨ DEPRECATED π¨
bestie. sit down. π
This distribution is deprecated in favor of Test2, Test2::Suite, and Test2::Workflow.
For a conversion guide, go look at Test::Stream::Manual::ToTest2. that's the glow-up roadmap, fr fr.
πΈ DESCRIPTION πΈ
This module hands you the aux cord for the random seed your unit tests use. lowkey in some testing environments the random seed is the main character of your results β it can swing things in a big way.
The default configuration for this module seeds srand with the local date. Using the date as the seed means that on any given day the random seed is always the same, so behavior will not change from run to run on a given day. But the seed is different on different days, which lets you be sure your code still works with actual randomness. it's giving "stable but still spicy". π
The seed is printed for you on failure, or when the harness is verbose. You can use the TS_RAND_SEED environment variable to specify the seed. You can also hand over a specific seed as a load-time argument to the plugin. π«Ά
π SYNOPSIS π
Loading the plugin is easy and the defaults are sane:
use Test::Stream 'SRand';
Custom seed:
use Test::Stream SRand => ['42'];
β NOTE ON LOAD ORDER β
If you use this plugin you probably want to use it as the first plugin, or near-first. srand is not called until the plugin is loaded, so other plugins loaded before it may already be out here making use of random numbers before your seed takes effect. not them getting a head start π so yeah β load it early, periodt.
π₯ SOURCE π₯
The source code repository for Test::Stream can be found at http://github.com/Test-More/Test-Stream/.
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>
π¦ AUTHORS π¦
- Chad Granum
<exodist@cpan.org>
π COPYRIGHT π
Copyright 2015 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
ok that's the whole page, no skips, no crumbs left behind π remember: deprecated, seed comes from the local date by default, TS_RAND_SEED exists, load it first, and the seed shows up on failure or when the harness is verbose. iykyk.
and that's a wrap, bestie π this one's from perl v5.42.0, dated 2025-07-25, and it's the Test::S...n::SRand(3) page β slay, go write some tests π
β¨
π¦ where this page comes from
- fedora 43: perl-Test-Stream 1.302027-35.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms