MCPcopy Index your code
hub / github.com/RustPython/RustPython / rand_add

Function rand_add

crates/stdlib/src/openssl.rs:505–512  ·  view source on GitHub ↗
(string: ArgStrOrBytesLike, entropy: f64)

Source from the content-addressed store, hash-verified

503
504 #[pyfunction(name = "RAND_add")]
505 fn rand_add(string: ArgStrOrBytesLike, entropy: f64) {
506 let f = |b: &[u8]| {
507 for buf in b.chunks(libc::c_int::MAX as usize) {
508 unsafe { sys::RAND_add(buf.as_ptr() as *const _, buf.len() as _, entropy) }
509 }
510 };
511 f(&string.borrow_bytes())
512 }
513
514 #[pyfunction(name = "RAND_bytes")]
515 fn rand_bytes(n: i32, vm: &VirtualMachine) -> PyResult<Vec<u8>> {

Callers

nothing calls this directly

Calls 6

RAND_addFunction · 0.85
borrow_bytesMethod · 0.80
fFunction · 0.50
chunksMethod · 0.45
as_ptrMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected