Results: 1.08 - 2.83
#include <stdio.h>
#include <stdlib.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <wincrypt.h>
unsigned long count[4];
int __cdecl main(void){
HCRYPTPROV cp;
int tgt;
(void)CryptAcquireContextA(&cp,NULL,NULL,PROV_RSA_FULL,CRYPT_VERIFYCONTEXT);
for(int i = 0; i < 100; i++){
CryptGenRandom(cp,sizeof(int),(void*)&tgt);
int idx = abs(tgt % 4);
++count[idx];
//printf("%2d %2d %2d %2d %2d %d\n", count[0], count[1], count[2], count[3], idx, tgt);
}
(void)CryptReleaseContext(cp,0);
printf(" 1 2 3 4\n%2d %2d %2d %2d\n", count[0], count[1], count[2], count[3]);
int min=100, max=0;
for (int i=0; i<4; i++) {
if (count[i] < min) min = count[i];
if (count[i] > max) max = count[i];
}
printf("%0.2f %d %d\n", (double)max/min, min, max);
return EXIT_SUCCESS;
}
rand() based gives 1.08