Skip to content

Instantly share code, notes, and snippets.

@learno
learno / prn256.c
Created July 2, 2021 06:50 — forked from cloudwu/prn256.c
xoshiro256 from lua 5.4
// 'xoshiro256**' algorithm from lua 5.4 implementation
#include "random.h"
#include <stdint.h>
#include <assert.h>
static inline uint64_t *
state(struct prn_state *P) {
assert(sizeof(*P) == sizeof(uint64_t) * 4);
return (uint64_t *)P;
}
@learno
learno / benchmark.lua
Created August 12, 2016 08:32 — forked from bjorn/benchmark.lua
Lua OOP benchmark
-- This benchmark compares two ways of creating objects.
-- Output commonly seen on the Lua demo site:
--
-- Creation time: 0.16
-- Calling member function time: 0.11
-- Memory: 2868.8798828125
--
-- Creation time: 0.11
-- Calling member function time: 0.13
-- Memory: 1697.4736328125
@learno
learno / test.py
Created February 23, 2012 21:40 — forked from e7h4n/test.py
#encoding=utf-8
'''
找出一个锯齿数组里长度大于5的子数组
在符合要求的子数组里的数据里找出所有偶数
如果数据小于10的话乘以2,大于10的除以2
最后统计符合要求的数据的和
'''
inputdata = [
[2,8,9,13,72,67,88,35,44],
[33,28,47,2,10,45,66,92],