added directions and random element test

added directions and random element test