Wrote better random testfunction