Exclude entry based on segment
No matter how many levels there are in your structure ancestorOf will fetch level one entry. entry.parent could be used but covers only one level up.

{% set excludeEntry = entry %}
{% if entry.level &gt; 1 %}
    {% set excludeEntry = craft.entries.ancestorOf(entry).level(1).first() %}
{% endif %}

{% for entry in craft.entries.section('Thunder').level(1).id('not '~excludeEntry.id).limit(3).order('RAND()') %}
...
{% endfor %}