Skip to content
Snippets Groups Projects
Commit 8177c4f8 authored by David Hedbor's avatar David Hedbor
Browse files

Memory and speed optimized pike_random->read

Rev: lib/modules/Crypto/randomness.pmod:1.9
parent 59f26c8d
No related branches found
No related tags found
No related merge requests found
......@@ -70,10 +70,8 @@ PRIVATE string some_entropy()
class pike_random {
string read(int len)
{
return sprintf("%@c", Array.map(allocate(len), lambda(int dummy)
{
return random(256);
} ));
if (len > 16384) return read(len/2)+read(len-len/2);
return (string)allocate(len, random)(256);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment