Skip to content

Commit

Permalink
wasm: improve function pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
gorazdko committed Mar 11, 2021
1 parent 81691de commit 67c1404
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions wasm/sskr.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@
var newFuncPtr = addFunction(function(bufferPointer, count, contextPointer) {
// this implements arandom number generator
// It is passed to a function pointer
var array = new Uint32Array(1);
var array = new Uint8Array(count);
window.crypto.getRandomValues(array);
setValue(bufferPointer, array[0], 'i32')
for (var i = 0; i < count; i++) {
setValue(bufferPointer + i, array[i], 'i8')
}

}, 'viii');

const {
Expand Down

0 comments on commit 67c1404

Please sign in to comment.