This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Written in 2017 by Tommy Ettinger (tommy.ettinger@gmail.com) | |
To the extent possible under law, the author has dedicated all copyright | |
and related and neighboring rights to this software to the public domain | |
worldwide. This software is distributed without any warranty. | |
See <http://creativecommons.org/publicdomain/zero/1.0/>. */ | |
#include <stdint.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Written in 2017 by Tommy Ettinger (tommy.ettinger@gmail.com) | |
To the extent possible under law, the author has dedicated all copyright | |
and related and neighboring rights to this software to the public domain | |
worldwide. This software is distributed without any warranty. | |
See <http://creativecommons.org/publicdomain/zero/1.0/>. */ | |
#include <stdint.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2020 damios | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at: | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gets a quasi-random Vector2 between (0f,0f) inclusive and (1f,1f) exclusive, assigning into {@code into} the | |
* {@code index}-th point in the (2, 3) Halton sequence. If index is unique, the Vector2 should be as well for all | |
* but the largest values of index. You might find an advantage in using values for index that start higher than | |
* 20 or so, but you can pass sequential values for index and generally get Vector2s that won't be near each other; | |
* this is not true for all parameters to Halton sequences, but it is true for this one. | |
* @param into the Vector2 to place the result into and return | |
* @param index an int that, if unique, positive, and not too large, will usually result in unique Vector2 values | |
* @return into, modified; usually will have a comfortable distance from Vector2s produced with close index values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This random game idea generator was a collaboration between David O'Toole (dto) | |
and myself (Tommy Ettinger). The generator is a Clojure program that is available | |
to fork and tweak at http://ideone.com/0MG8ED . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
namespace SquidLib.SquidMath { | |
/// <summary> | |
/// Only for use with indexers in IndexedDictionary to show you want to access a key. | |
/// There is only one enum constant here, At. | |
/// </summary> | |
public enum Key { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This includes JDK8 and Guava 28 data structures, with the analysis done by https://github.com/DimitrisAndreou/memory-measurer . | |
========================================== 64-bit architecture ========================================== | |
========================================== Basic Lists, Sets, Maps ========================================== | |
ArrayList :: Bytes = 4.71, Objects = 0.00 Refs = 1.18 Primitives = {} | |
ImmutableList :: Bytes = 4.00, Objects = 0.00 Refs = 1.00 Primitives = {} | |
HashSet :: Bytes = 40.24, Objects = 1.00 Refs = 5.06 Primitives = {int=1.0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------- depth 0 | |
┌───┐┌────┐ ┌─┐ ┌────┐ | |
┌┘.""└┘....└┐ ┌┘.└┐ ┌┘....└┐ | |
┌┘...""...#..│┌────────┐ ┌┘...└┐│..#...└──┐ | |
│............└┘.,~~~~,.└──┐ │.....││.........└┐ | |
└┐..............───~~.....└┐ └┐...─┴┘...│..┌┐..│ ┌─┐ | |
│...............,,~~......│ │.........│..└┘..└─┬────┘.└┐ | |
├─.────.........,.┌┐......│ └┐.┌──┐...└─.......│.......└┐ | |
│................┌┘│.....┌┘ └─┘ │.....................│ | |
└┐.┌──┐.┌┐....┌──┴┐├─..┌─┴┐ │...┌──┐.............┌┘ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌─────────────┬─────┬───────────────┐ ┌─────┬───────────┐ ┌─────┐ ┌───────┐ ┌─────────┐ ┌─────┬───────────┐ ┌─────────┐ | |
│ . . . . . . │ . . │ . . . . . . . └───┘ . . │ . . . . . │ │ . . │ ┌─┘ . . . ├───────────────┘ . . . . └───┘ . . │ . . . . . │ │ . . . . │ | |
│ . . . . . . │ . . │ . . ────. . . . . . . . │ . . . . . ├───────┘ . . └─┐ │ . . . . │ . . . . . . . . . . . . . . . . . │ . . . . . │ ┌─┘ . . . ┌─┘ | |
│ . . │ . ┌───┘ . . │ . . . . . . . . . . . . │ . . . . . │ . . . . . . . │ │ . . . ┌─┤ . . . . . . . . . . . . . . . . . │ . . . . . └─┘ . . . . └───┐ | |
│ . . │ . │ . . . . . . . ──┬───────┬───┐ . . └─+ ──┐ . . . . . . . . . . │ │ . . ┌─┘ │ . . │ . . ┌───+ ┬─┐ . . ┌───┐ . . │ . . │ . . . . . . . . . . └─┐ | |
│ . . │ . │ . . . . . . . . │ . . . │ │ . . . . . │ . . . . . . ┌─┐ . . └─────┘ . . └───┘ . . │ . . │ . . │ │ . . │ │ . . . . . │ . . . . . . . . . . . └─┐ | |
│ . . . . │ . . . . │ . . . │ . . . │ │ . . . . . │ . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Provides a {@link #probit(double)} method to convert from the (0.0,1.0) domain to a Gaussian range. | |
* Uses an algorithm by Peter John Acklam, as implemented by Sherali Karimov. | |
* Free to use, but you should credit Acklam and Karimov appropriately. | |
*/ | |
public final class Probit { | |
private static final double LOW = 0.02425; | |
private static final double HIGH = 1.0 - LOW; | |
// Coefficients in rational approximations. |
NewerOlder