How to use shuffle on my partiall

@SamHamou try this …

<!-- Widget Random -->
{{ $filteredPosts := where .Site.RegularPages "Type" "in" site.Params.mainSections }}          
{{ $relatedPosts := shuffle $filteredPosts | first 3 }}  
          

{{- if $recent }}
<div class="widget-recent widget">
	<h4 class="widget__title">{{ T "recent_title" }}</h4>
	<div class="widget__content">
		<ul class="widget__list">
			{{ range $relatedPosts }}  
			<li class="widget__item">
				<a class="widget__link widget-recent__item" href="{{ .RelPermalink }}">
				{{- if .Params.thumbnail }}
					<img class="widget-recent__thumbnail" src="{{ .Params.thumbnail }}"/>
					{{ .Title }}
				{{- else }}
					- {{ .Title }}
				{{- end }}
				</a>
			</li>
			{{- end }}
		</ul>
	</div>
</div>
{{- end }}
<!-- Widget Random -->