Skip to content

Instantly share code, notes, and snippets.

@andanteyk
andanteyk / Shuffle.cs
Created December 30, 2024 06:00
Fast shuffle by batching
using System.Numerics;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Linq;
using System;
using System.Runtime.CompilerServices;
// Test code
var rng = new Seiran128();
@andanteyk
andanteyk / ibukihash.hlsl
Created December 19, 2024 10:00
IbukiHash
// IbukiHash by Andante (https://twitter.com/andanteyk)
// This work is marked with CC0 1.0. To view a copy of this license, visit https://creativecommons.org/publicdomain/zero/1.0/
float ibuki(float4 v)
{
const uint4 mult =
uint4(0xae3cc725, 0x9fe72885, 0xae36bfb5, 0x82c1fcad);
uint4 u = uint4(v);
u = u * mult;
@andanteyk
andanteyk / PerlinTest.shader
Last active December 1, 2024 09:30
Perlin and Simplex noise implementation
// This work is marked with CC0 1.0. To view a copy of this license, visit https://creativecommons.org/publicdomain/zero/1.0/
Shader "Unlit/PerlinTest"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Transparent" }
@andanteyk
andanteyk / TMP_Bitmap_Shadow.shader
Created February 10, 2024 11:36
ピクセルフォント囲み/影シェーダ
Shader "TextMeshPro/Bitmap_Shadow" { // この名前を変える
Properties {
_MainTex ("Font Atlas", 2D) = "white" {}
_FaceTex ("Font Texture", 2D) = "white" {}
[HDR]_FaceColor ("Text Color", Color) = (1,1,1,1)
[HDR]_ShadowColor ("Shadow Color", Color) = (0.5,0.5,0.5,1) // 追加
_ShadowFlag ("Shadow Flag", int) = 255 // 追加
// TMP を騙す
@andanteyk
andanteyk / Ziggurat.cs
Created April 30, 2023 07:14
Ziggurat / Modified Ziggurat method
// This code is licensed under the terms of the MIT license.
// For details, see https://gist.github.com/andanteyk/d08ab296665b3fc68df58beff3ea39cb .
// How to build:
// > dotnet new console
// > dotnet add package BenchmarkDotNet
// > dotnet run -c Release
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
#if UNITY_2019_1_OR_NEWER
// in unity environment
using UnityEngine;
using System.Reflection;
#else
// in dotnet environment
@andanteyk
andanteyk / LxmTest.cs
Created March 16, 2023 01:36
LXM PRNG test vectors
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RngLab.Rng.Generators;
using System.Linq;
namespace RngLab.UnitTest.Generators;
[TestClass]
public class LxmTest
{
[TestMethod]
@andanteyk
andanteyk / unicode_sample.txt
Created June 19, 2022 08:05
Unicode の入力・表示テストに使える文字(列) (U+0000 null を除く)
 
العربية
ABCD
‮DCBA
لدي 100 تفاحة.
@andanteyk
andanteyk / Seiran.cs
Last active October 4, 2022 03:40
Seiran128 sample implementation in C# (.NET 5)
using System;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
// This code is licensed under the terms of the MIT license.
// For details, see https://gist.github.com/andanteyk/d08ab296665b3fc68df58beff3ea39cb .
@andanteyk
andanteyk / houm_leng.txt
Created March 5, 2020 15:07
命中と射程が上がる組み合わせ
※命中と射程が上がるものだけ抜粋
41cm三連装砲改二:
 伊勢改二 (命中+3, 火力+3, 対空+2, 回避+1) x搭載数
 日向改二 (命中+3, 火力+3, 対空+2, 回避+2) x搭載数
二式艦上偵察機:
 伊勢改二 (命中+5, 火力+3, 回避+2, 装甲+1, 射程+1)
 日向改二 (命中+5, 火力+3, 回避+3, 装甲+3, 射程+1)
 飛龍改二 (命中+5, 射程+1), [★1以上](火力+2, 索敵+2)