15 lines
556 B
Julia
15 lines
556 B
Julia
"Allocate an UInt8 array of length size, all zeros"
|
|
allocate(size) = zeros(UInt8, size)
|
|
const SRND = Random.RandomDevice()
|
|
"Allocate a criptographycally secure random UInt8 array of length size"
|
|
rallocate(size) = rand(# SRND, # FIXME: Sometimes it freeze...
|
|
UInt8, size)
|
|
|
|
"""Replace all elements of an array with zeros. A custom function accepting
|
|
"type" may be passed as FUNC argument used instead of ZERO"""
|
|
function erase!(array::Array{T}; func = zero) where T
|
|
for i in 1:length(array)
|
|
array[i] = func(T)
|
|
end
|
|
end
|