Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-plan/src/dsl/function_expr/random.rs
6940 views
1
#[cfg(feature = "serde")]
2
use serde::{Deserialize, Serialize};
3
use strum_macros::IntoStaticStr;
4
5
use super::*;
6
7
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
8
#[cfg_attr(feature = "dsl-schema", derive(schemars::JsonSchema))]
9
#[derive(Copy, Clone, PartialEq, Debug, IntoStaticStr)]
10
#[strum(serialize_all = "snake_case")]
11
pub enum RandomMethod {
12
Shuffle,
13
Sample {
14
is_fraction: bool,
15
with_replacement: bool,
16
shuffle: bool,
17
},
18
}
19
20
impl Hash for RandomMethod {
21
fn hash<H: Hasher>(&self, state: &mut H) {
22
std::mem::discriminant(self).hash(state)
23
}
24
}
25
26