| 583 | } |
| 584 | |
| 585 | std::shared_ptr<Array> RandomArrayGenerator::FixedSizeBinary( |
| 586 | int64_t size, int32_t byte_width, double null_probability, uint8_t min_byte, |
| 587 | uint8_t max_byte, int64_t alignment, MemoryPool* memory_pool) { |
| 588 | if (null_probability < 0 || null_probability > 1) { |
| 589 | ABORT_NOT_OK(Status::Invalid("null_probability must be between 0 and 1")); |
| 590 | } |
| 591 | |
| 592 | // Visual Studio does not implement uniform_int_distribution for char types. |
| 593 | using GenOpt = GenerateOptions<uint8_t, std::uniform_int_distribution<uint16_t>>; |
| 594 | GenOpt options(seed(), min_byte, max_byte, null_probability); |
| 595 | |
| 596 | int64_t null_count = 0; |
| 597 | auto null_bitmap = *AllocateEmptyBitmap(size, alignment, memory_pool); |
| 598 | auto data_buffer = *AllocateBuffer(size * byte_width, alignment, memory_pool); |
| 599 | options.GenerateBitmap(null_bitmap->mutable_data(), size, &null_count); |
| 600 | options.GenerateData(data_buffer->mutable_data(), size * byte_width); |
| 601 | |
| 602 | auto type = fixed_size_binary(byte_width); |
| 603 | return std::make_shared<FixedSizeBinaryArray>(type, size, std::move(data_buffer), |
| 604 | std::move(null_bitmap), null_count); |
| 605 | } |
| 606 | |
| 607 | namespace { |
| 608 | |