odin-blend2d

Odin bindings to Blend2D
Log | Files | Refs | README | LICENSE

random.odin (1018B)


      1 // This file is part of Blend2D project <https://blend2d.com>
      2 //
      3 // See blend2d.h or LICENSE.md for license and copyright information
      4 // SPDX-License-Identifier: Zlib
      5 package blend2d
      6 
      7 when ODIN_OS == .Windows {
      8 	foreign import lib "blend2d.lib"
      9 } else when ODIN_OS == .Darwin {
     10 	foreign import lib "libblend2d.a"
     11 } else when ODIN_OS == .Linux {
     12 	foreign import lib "libblend2d.a"
     13 }
     14 
     15 
     16 @(default_calling_convention="c", link_prefix="bl_")
     17 foreign lib {
     18 	//! \name BLRandom - C API
     19 	//! \{
     20 	random_reset       :: proc(self: ^Random, seed: u64) -> Result ---
     21 	random_next_uint32 :: proc(self: ^Random) -> u32 ---
     22 	random_next_uint64 :: proc(self: ^Random) -> u64 ---
     23 	random_next_double :: proc(self: ^Random) -> f64 ---
     24 }
     25 
     26 //! Simple pseudo random number generator based on `XORSHIFT+`, which has 64-bit seed, 128 bits of state, and full
     27 //! period `2^128 - 1`.
     28 //!
     29 //! Based on a paper by Sebastiano Vigna:
     30 //!   http://vigna.di.unimi.it/ftp/papers/xorshiftplus.pdf
     31 Random :: struct {
     32 	//! PRNG state.
     33 	data: [2]u64,
     34 }
     35