mercredi 13 novembre 2019

Recreating GNU C library's random() function in Python

I'm trying to recreate this algorithm but in python: https://www.mscs.dal.ca/~selinger/random/

However due to the way C initializes integer arrays in functions the values stored in the array when its first created aren't all zero's is this possible to replicate in python?

Example of what I mean by the undefined values stored in integer array in C:

#include <stdio.h>

int main(void) {
  int a[20];
  for(int i=0;i<20;i++){
    printf("%d\n",a[i]);
  }
  return 0;
}
0
0
0
0
0
0
15775231
0
1
0
4195741
0
354777504
32691
0
0
4195664
0
4195328
0



Aucun commentaire:

Enregistrer un commentaire