Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Rust agent-skillsclaude-codeclicode-migrationcodexffigolangjavajavascriptmcpmigrationnapiperformanceportingpyo3pythonrewriterubyrusttypescript
C: count random, arc4random and the rand48 family as randomness (#1389)
jakalijey0da1660f775f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 46028853..04439c99 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -223,6 +223,9 @@(#1337 by @jakalijey).from one JVM start to the next. `List.of`, `Collectors.toList`, and a `toMap` or `groupingBy`given a `TreeMap` or `LinkedHashMap` supplier are not (#1343 by @jakalijey).+- C: `random`, `arc4random`, `arc4random_uniform`, `arc4random_buf`, `drand48`, `erand48`,+ `lrand48`, `nrand48`, `mrand48`, `jrand48` and `rand_r` count as reading randomness, as `rand`+ already did, in `analyze` and `bridge` (#1372 by @jakalijey).- C#: a method whose parameter default is not a literal (`int width = Width`, `Pad.Width`,`Width * 2`) stays in C# with the reason, as PHP does for a class constant: the wrapper is anotherclass, so the name did not compile there. Numbers, strings, chars, `true`, `false`, `null` anddiff --git a/src/lang/effects.rs b/src/lang/effects.rsindex 4b3bb889..8e2c5bc0 100644--- a/src/lang/effects.rs+++ b/src/lang/effects.rs@@ -298,7 +298,22 @@ fn clock_and_random(lang: Lang) -> &'static [&'static str] {".randomElement(",".shuffled(",],- Lang::C => &["time(", "rand(", "clock("],+ Lang::C => &[+ "time(",+ "rand(",+ "clock(",+ "random(",+ "arc4random(",+ "arc4random_uniform(",+ "arc4random_buf(",+ "drand48(",+ "erand48(",+ "lrand48(",+ "nrand48(",+ "mrand48(",+ "jrand48(",+ "rand_r(",+ ],}}@@ -1439,6 +1454,14 @@ mod tests {}// The clock matters when nothing is passed: one recorded case is one moment.assert!(reason(Lang::Python, &[], "def f():\n return time.time()").is_some());+ assert!(+ reason(+ Lang::C,+ &[],+ "int pick(void) {\n return (int)arc4random_uniform(6) + 1;\n}\n"+ )+ .is_some()+ );assert_eq!(reason(Lang::Python,@@ -1470,6 +1493,18 @@ mod tests {fn scans_list_environment_clock_and_hash_order_in_every_spelling() {use crate::risks::Risk;let cases: &[(Lang, &str, &str, Risk)] = &[+ (+ Lang::C,+ "dice.c",+ "int roll(void) {\n return (int)(random() % 6) + 1;\n}\n",+ Risk::ClockAndRandom,+ ),+ (+ Lang::C,+ "dice.c",+ "double unit(void) {\n return drand48();\n}\n",+ Risk::ClockAndRandom,+ ),(Lang::Swift,"Deck.swift",