2024-10-20 05:21:03 +00:00
|
|
|
package qt6
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qrandom.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QRandomGenerator struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QRandomGenerator
|
|
|
|
isSubclass bool
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) cPointer() *C.QRandomGenerator {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQRandomGenerator constructs the type using only CGO pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func newQRandomGenerator(h *C.QRandomGenerator) *QRandomGenerator {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return &QRandomGenerator{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQRandomGenerator constructs the type using only unsafe pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func UnsafeNewQRandomGenerator(h unsafe.Pointer) *QRandomGenerator {
|
2024-11-19 06:29:06 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return &QRandomGenerator{h: (*C.QRandomGenerator)(h)}
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator constructs a new QRandomGenerator object.
|
|
|
|
func NewQRandomGenerator() *QRandomGenerator {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator_new(&outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator(outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator2 constructs a new QRandomGenerator object.
|
|
|
|
func NewQRandomGenerator2(seedBuffer *uint, lenVal int64) *QRandomGenerator {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator_new2((*C.uint)(unsafe.Pointer(seedBuffer)), (C.ptrdiff_t)(lenVal), &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator(outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator3 constructs a new QRandomGenerator object.
|
|
|
|
func NewQRandomGenerator3(begin *uint, end *uint) *QRandomGenerator {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator_new3((*C.uint)(unsafe.Pointer(begin)), (*C.uint)(unsafe.Pointer(end)), &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator(outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator4 constructs a new QRandomGenerator object.
|
|
|
|
func NewQRandomGenerator4(other *QRandomGenerator) *QRandomGenerator {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator_new4(other.cPointer(), &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator(outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator5 constructs a new QRandomGenerator object.
|
|
|
|
func NewQRandomGenerator5(seedValue uint) *QRandomGenerator {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator_new5((C.uint)(seedValue), &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator(outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) OperatorAssign(other *QRandomGenerator) {
|
|
|
|
C.QRandomGenerator_OperatorAssign(this.h, other.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Generate() uint {
|
|
|
|
return (uint)(C.QRandomGenerator_Generate(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Generate64() uint64 {
|
|
|
|
return (uint64)(C.QRandomGenerator_Generate64(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) GenerateDouble() float64 {
|
|
|
|
return (float64)(C.QRandomGenerator_GenerateDouble(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded(highest float64) float64 {
|
|
|
|
return (float64)(C.QRandomGenerator_Bounded(this.h, (C.double)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) BoundedWithHighest(highest uint) uint {
|
|
|
|
return (uint)(C.QRandomGenerator_BoundedWithHighest(this.h, (C.uint)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded2(lowest uint, highest uint) uint {
|
|
|
|
return (uint)(C.QRandomGenerator_Bounded2(this.h, (C.uint)(lowest), (C.uint)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded3(highest int) int {
|
|
|
|
return (int)(C.QRandomGenerator_Bounded3(this.h, (C.int)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded4(lowest int, highest int) int {
|
|
|
|
return (int)(C.QRandomGenerator_Bounded4(this.h, (C.int)(lowest), (C.int)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded5(highest uint64) uint64 {
|
|
|
|
return (uint64)(C.QRandomGenerator_Bounded5(this.h, (C.ulonglong)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded6(lowest uint64, highest uint64) uint64 {
|
|
|
|
return (uint64)(C.QRandomGenerator_Bounded6(this.h, (C.ulonglong)(lowest), (C.ulonglong)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded7(highest int64) int64 {
|
|
|
|
return (int64)(C.QRandomGenerator_Bounded7(this.h, (C.longlong)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded8(lowest int64, highest int64) int64 {
|
|
|
|
return (int64)(C.QRandomGenerator_Bounded8(this.h, (C.longlong)(lowest), (C.longlong)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded9(lowest int, highest int64) int64 {
|
|
|
|
return (int64)(C.QRandomGenerator_Bounded9(this.h, (C.int)(lowest), (C.longlong)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded10(lowest int64, highest int) int64 {
|
|
|
|
return (int64)(C.QRandomGenerator_Bounded10(this.h, (C.longlong)(lowest), (C.int)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded11(lowest uint, highest uint64) uint64 {
|
|
|
|
return (uint64)(C.QRandomGenerator_Bounded11(this.h, (C.uint)(lowest), (C.ulonglong)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Bounded12(lowest uint64, highest uint) uint64 {
|
|
|
|
return (uint64)(C.QRandomGenerator_Bounded12(this.h, (C.ulonglong)(lowest), (C.uint)(highest)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Generate2(begin *uint, end *uint) {
|
|
|
|
C.QRandomGenerator_Generate2(this.h, (*C.uint)(unsafe.Pointer(begin)), (*C.uint)(unsafe.Pointer(end)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) OperatorCall() uint {
|
|
|
|
return (uint)(C.QRandomGenerator_OperatorCall(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Seed() {
|
|
|
|
C.QRandomGenerator_Seed(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Discard(z uint64) {
|
|
|
|
C.QRandomGenerator_Discard(this.h, (C.ulonglong)(z))
|
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator_Min() uint {
|
|
|
|
return (uint)(C.QRandomGenerator_Min())
|
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator_Max() uint {
|
|
|
|
return (uint)(C.QRandomGenerator_Max())
|
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator_System() *QRandomGenerator {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQRandomGenerator(C.QRandomGenerator_System())
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator_Global() *QRandomGenerator {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQRandomGenerator(C.QRandomGenerator_Global())
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator_SecurelySeeded() *QRandomGenerator {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQRandomGenerator(C.QRandomGenerator_SecurelySeeded())
|
2024-10-20 05:21:03 +00:00
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator) Seed1(s uint) {
|
|
|
|
C.QRandomGenerator_Seed1(this.h, (C.uint)(s))
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delete this object from C++ memory.
|
|
|
|
func (this *QRandomGenerator) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QRandomGenerator_Delete(this.h, C.bool(this.isSubclass))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
|
|
|
// from C++ memory once it is unreachable from Go memory.
|
|
|
|
func (this *QRandomGenerator) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QRandomGenerator) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type QRandomGenerator64 struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QRandomGenerator64
|
|
|
|
isSubclass bool
|
2024-10-20 05:21:03 +00:00
|
|
|
*QRandomGenerator
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator64) cPointer() *C.QRandomGenerator64 {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator64) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQRandomGenerator64 constructs the type using only CGO pointers.
|
|
|
|
func newQRandomGenerator64(h *C.QRandomGenerator64, h_QRandomGenerator *C.QRandomGenerator) *QRandomGenerator64 {
|
2024-10-20 05:21:03 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-11-19 06:29:06 +00:00
|
|
|
return &QRandomGenerator64{h: h,
|
|
|
|
QRandomGenerator: newQRandomGenerator(h_QRandomGenerator)}
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQRandomGenerator64 constructs the type using only unsafe pointers.
|
|
|
|
func UnsafeNewQRandomGenerator64(h unsafe.Pointer, h_QRandomGenerator unsafe.Pointer) *QRandomGenerator64 {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return &QRandomGenerator64{h: (*C.QRandomGenerator64)(h),
|
|
|
|
QRandomGenerator: UnsafeNewQRandomGenerator(h_QRandomGenerator)}
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator64 constructs a new QRandomGenerator64 object.
|
|
|
|
func NewQRandomGenerator64() *QRandomGenerator64 {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator64 *C.QRandomGenerator64 = nil
|
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator64_new(&outptr_QRandomGenerator64, &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator64(outptr_QRandomGenerator64, outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator642 constructs a new QRandomGenerator64 object.
|
|
|
|
func NewQRandomGenerator642(seedBuffer *uint, lenVal int64) *QRandomGenerator64 {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator64 *C.QRandomGenerator64 = nil
|
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator64_new2((*C.uint)(unsafe.Pointer(seedBuffer)), (C.ptrdiff_t)(lenVal), &outptr_QRandomGenerator64, &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator64(outptr_QRandomGenerator64, outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator643 constructs a new QRandomGenerator64 object.
|
|
|
|
func NewQRandomGenerator643(begin *uint, end *uint) *QRandomGenerator64 {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator64 *C.QRandomGenerator64 = nil
|
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator64_new3((*C.uint)(unsafe.Pointer(begin)), (*C.uint)(unsafe.Pointer(end)), &outptr_QRandomGenerator64, &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator64(outptr_QRandomGenerator64, outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator644 constructs a new QRandomGenerator64 object.
|
|
|
|
func NewQRandomGenerator644(other *QRandomGenerator) *QRandomGenerator64 {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator64 *C.QRandomGenerator64 = nil
|
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator64_new4(other.cPointer(), &outptr_QRandomGenerator64, &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator64(outptr_QRandomGenerator64, outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator645 constructs a new QRandomGenerator64 object.
|
|
|
|
func NewQRandomGenerator645(param1 *QRandomGenerator64) *QRandomGenerator64 {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator64 *C.QRandomGenerator64 = nil
|
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator64_new5(param1.cPointer(), &outptr_QRandomGenerator64, &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator64(outptr_QRandomGenerator64, outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQRandomGenerator646 constructs a new QRandomGenerator64 object.
|
|
|
|
func NewQRandomGenerator646(seedValue uint) *QRandomGenerator64 {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QRandomGenerator64 *C.QRandomGenerator64 = nil
|
|
|
|
var outptr_QRandomGenerator *C.QRandomGenerator = nil
|
|
|
|
|
|
|
|
C.QRandomGenerator64_new6((C.uint)(seedValue), &outptr_QRandomGenerator64, &outptr_QRandomGenerator)
|
|
|
|
ret := newQRandomGenerator64(outptr_QRandomGenerator64, outptr_QRandomGenerator)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator64) Generate() uint64 {
|
|
|
|
return (uint64)(C.QRandomGenerator64_Generate(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator64) OperatorCall() uint64 {
|
|
|
|
return (uint64)(C.QRandomGenerator64_OperatorCall(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator64) Discard(z uint64) {
|
|
|
|
C.QRandomGenerator64_Discard(this.h, (C.ulonglong)(z))
|
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator64_Min() uint64 {
|
|
|
|
return (uint64)(C.QRandomGenerator64_Min())
|
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator64_Max() uint64 {
|
|
|
|
return (uint64)(C.QRandomGenerator64_Max())
|
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator64_System() *QRandomGenerator64 {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQRandomGenerator64(C.QRandomGenerator64_System(), nil)
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator64_Global() *QRandomGenerator64 {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQRandomGenerator64(C.QRandomGenerator64_Global(), nil)
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QRandomGenerator64_SecurelySeeded() *QRandomGenerator64 {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQRandomGenerator64(C.QRandomGenerator64_SecurelySeeded(), nil)
|
2024-10-20 05:21:03 +00:00
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QRandomGenerator64) OperatorAssign(param1 *QRandomGenerator64) {
|
|
|
|
C.QRandomGenerator64_OperatorAssign(this.h, param1.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delete this object from C++ memory.
|
|
|
|
func (this *QRandomGenerator64) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QRandomGenerator64_Delete(this.h, C.bool(this.isSubclass))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
|
|
|
// from C++ memory once it is unreachable from Go memory.
|
|
|
|
func (this *QRandomGenerator64) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QRandomGenerator64) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|