Sigrid Solveig Haflínudóttir3rd/mp: import mpnrand5994c2d11 months agoHistory
20 lines · 304 B · C
RawDownload
#include "platform.h"#include "mp.h" /* return uniform random [0..n-1] */mpint*mpnrand(mpint *n, void (*gen)(u8int*, int), mpint *b){	int bits; 	bits = mpsignif(n);	if(bits == 0)		abort();	if(b == nil)		b = mpnew(bits);	do{		mprand(bits, gen, b);	}while(mpmagcmp(b, n) >= 0); 	return b;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t