pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:2182:
PIKEFUN array random(mapping m) { struct keypair *k; int e, count; if(!m_sizeof(m)) SIMPLE_ARG_TYPE_ERROR("random", 1, "mapping with elements in it"); count = read_int( m_sizeof(m) );
-
/* We could optimize this by not iterating over hash buckets we will
-
not pick a member from. */
-
+
NEW_MAPPING_LOOP(m->data) { if(count-- < 1) { push_svalue(&k->ind); push_svalue(&k->val); f_aggregate(2); return; } }