added frandom support. Source from https://github.com/Ryuinferno