How to create a function in MySQL that will return a random bool
It looks like you had a couple of errors. Try

CREATE FUNCTION IS_ROLEMEMBER (Rolename VARCHAR(255), Username VARCHAR(255)) 
RETURNS BINARY 
READS SQL DATA
RETURN 
( 
    SELECT (FLOOR(RAND() * 10) % 2)
);


The main errors I saw were:

@Rolename and @Username - no need to use @

RETURNS BINARY AS - no need for AS

I included the READS SQL DATA line as this caused an error on my side otherwise. I believe this is related to replication, so depending on your set up you may not need it.