summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Weigt <juw@posteo.de>2026-01-19 15:08:33 +0100
committerJulian Weigt <juw@posteo.de>2026-02-04 15:56:58 +0100
commit728eaa21b765ecbf1ba4c0cbb8bb0f39ea7e5e05 (patch)
tree0c5bf4d886ea3f61068d48943142cd85e27d364e
parenta57aacd8116a2a0ba3f56f41883c9c5f30130927 (diff)
Add random function generator.
-rw-r--r--charf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/charf.c b/charf.c
index 33220ea..e882863 100644
--- a/charf.c
+++ b/charf.c
@@ -184,9 +184,17 @@ int generate_triangle(VALUETYPE* f, int i){
else return -1;
}
+int generate_random(VALUETYPE* f, int i){
+ f[0] = int_to_valuetype(1);
+ f[1] = int_to_valuetype(0);
+ for(int n=2; n < N; n++) f[n] = int_to_valuetype(rand() % 2);
+ return N;
+}
+
/*Writes into f the values of the function indexed by i. Returns the size of the support of f, or -1 if there is no function with that index.*/
int generate_function(VALUETYPE* f, int i){
return generate_each_charf(f,i);
+ //return generate_random(f,i);
//return generate_triangle(f,i);
}