How to get the redstone power state of a block?

Issue description

I am making a block that randomly toggles redstone on and off. My psedocode for the procedure is:

 

on random tick:

     if power state is true

          power state is false

     else

          power state is true
     end
end

 

However, to do this, I will need a block that outputs the redstone power state of the block. Is there a block that does this? If so, Where is it?

Issue comments

Nvermind, all I have to do is create a variable that changes depending on the redstone on and restone off events.