Skip to content

Instantly share code, notes, and snippets.

View DSCF-1224's full-sized avatar

DSCF_1224 DSCF-1224

View GitHub Profile
@DSCF-1224
DSCF-1224 / main.f90
Created February 3, 2024 10:01
pong-wars (Fortran 2008 ver)
! original: https://github.com/vnglst/pong-wars
! gfortran -O3 -Wall -std=f2008 main.f90 && time ./a.out && gnuplot ./score.plt
program pong_wars
use , intrinsic :: iso_fortran_env
implicit none
@DSCF-1224
DSCF-1224 / main.jl
Last active August 14, 2024 21:46
Ziggurat法の定数計算用関数
# The Ziggurat Method for generating random variables - Marsaglia and Tsang
# Paper and reference code: http://www.jstatsoft.org/v05/i08/
module ZigguratTable
function compute_core( table_size::Int, pdf0::T, r::T, pdf::Core.Function, integral_pdf::Core.Function, inverse_pdf::Core.Function ) where { T <: Core.AbstractFloat }
v = ( r * pdf( r ) ) + integral_pdf( r )
x_ref = r
x_new = Base.zero( T )
@DSCF-1224
DSCF-1224 / prng.hpp
Last active November 26, 2024 22:08
PRNG using SIMD (AVX2)
#include <array>
#include <random>
#include <immintrin.h>
#ifndef PRNG_HPP_
#define PRNG_HPP_
namespace prng
{
template <typename T>
@DSCF-1224
DSCF-1224 / memo.md
Last active April 23, 2025 14:54
パイプの断面二次モーメント

Wolfram Language 14.1.0 Engine for Microsoft Windows (64-bit) での実行結果

Integrate[y^2 * 2 * Sqrt[r^2-y^2],{y,-r,r}, Assumptions -> r>0] // TeXForm

$$ \frac{\pi r^4}{4} $$