#[cfg(doc)]
use crate::{XorShift16, XorShift32, XorShift64};
#[doc = crate::_tags!(construction rand)]
#[doc = crate::_doc_location!("num/prob/rand")]
#[doc(hidden)]
#[macro_export]
#[rustfmt::skip]
#[cfg_attr(nightly_doc, doc(cfg(feature = "rand")))]
macro_rules! _define_xorshift {
(bits:$bits:literal, basis:$basis:expr, triplet:$triplet:expr, seed:$seed:expr) => {{
$crate::paste! {
const T: (u8, u8, u8) = $crate::[<XOROSHIFT_ $bits _TRIPLETS>][{ $triplet }];
$crate::[<XorShift $bits>]
::<{$basis}, {T.0 as usize}, {T.1 as usize}, {T.2 as usize}>
::new($seed)
}
}};
}
#[doc = crate::_tags!(rand)]
#[doc(inline)]
pub use _define_xorshift as define_xorshift;
#[doc = crate::_tags!(construction code rand)]
#[doc = crate::_doc_location!("num/prob/rand")]
macro_rules! xorshift_basis {
[$state:ident, $basis:expr, ($a:expr, $b:expr, $c:expr)] => {
match $basis {
0 => { $state^=$state << $a; $state^=$state >> $b; $state^=$state << $c; },
1 => { $state^=$state << $c; $state^=$state >> $b; $state^=$state << $a; },
2 => { $state^=$state >> $a; $state^=$state << $b; $state^=$state >> $c; },
3 => { $state^=$state >> $c; $state^=$state << $b; $state^=$state >> $a; },
4 => { $state^=$state << $a; $state^=$state << $c; $state^=$state >> $b; },
5 => { $state^=$state << $c; $state^=$state << $a; $state^=$state >> $b; },
6 => { $state^=$state >> $a; $state^=$state >> $c; $state^=$state << $b; },
7 => { $state^=$state >> $c; $state^=$state >> $a; $state^=$state << $b; },
_ => panic!("Error: xorshift $basis must be between 0..=7"),
}
};
}
pub(crate) use xorshift_basis;